user220: I've been looking for a while inside Arduino's files to find the core library. However, I haven't found them yet. Where on my hard drive can I obtain the core library files (.cpp and .h) necessary for all Arduino code?
Looking around on Google, I couldn't find a way to find the above files. I did see something about getting an .a file while Arduino is compiling, however, that isn't what I want. I want to browse the code and look at functions such as delay to see how they would react when given the values not expected. (i.e. Will my code stall if I use delay(-200); by not being to exit the loop, or will it create a black hole and disrupt the space-time continuum?)

user80026: I think this may have changed in newer versions. On my Mac Big Sur, Arduino 1.8.15 they are here: /Applications/Arduino.app/Contents/Java/libraries

user10794: There are multiple places where you can look. As at IDE 1.6.4 (Ubuntu version) some are in:
(install location)/libraries

But these are the high-level libraries, in particular:
Bridge
Esplora
Ethernet
Firmata
GSM
LiquidCrystal
Robot_Control
RobotIRremote
Robot_Motor
SD
Servo
SpacebrewYun
Stepper
Temboo
TFT
WiFi


That does not cover the low-level libraries like Tone, Print, main, etc. These are in:
(install location)/hardware/arduino/avr/cores/arduino

There you would find the Arduino core libraries like:
abi.cpp
Arduino.h
binary.h
CDC.cpp
Client.h
HardwareSerial0.cpp
HardwareSerial1.cpp
HardwareSerial2.cpp
HardwareSerial3.cpp
HardwareSerial.cpp
HardwareSerial.h
HardwareSerial_private.h
HID.cpp
hooks.c
IPAddress.cpp
IPAddress.h
main.cpp
new.cpp
new.h
Printable.h
Print.cpp
Print.h
Server.h
Stream.cpp
Stream.h
Tone.cpp
Udp.h
USBAPI.h
USBCore.cpp
USBCore.h
USBDesc.h
WCharacter.h
WInterrupts.c
wiring_analog.c
wiring.c
wiring_digital.c
wiring_private.h
wiring_pulse.c
wiring_shift.c
WMath.cpp
WString.cpp
WString.h


However even that does not locate things like strcpy. The header files for them can be found at:
(install location)/hardware/tools/avr/avr/include/

There you will find:
alloca.h
assert.h
ctype.h
errno.h
inttypes.h
math.h
setjmp.h
stdfix-avrlibc.h
stdint.h
stdio.h
stdlib.h
string.h


Even that is not the full story. In a subdirectory (avr) you will find the avr-related things, with files for different processors, such as (in part):
boot.h
builtins.h
common.h
cpufunc.h
crc16.h
delay.h
eeprom.h
fuse.h
interrupt.h
io1200.h
io2313.h
...
iox64d4.h
iox8e5.h
lock.h
parity.h
pgmspace.h
portpins.h
power.h
sfr_defs.h
signal.h
signature.h
sleep.h
version.h
wdt.h
xmega.h


As for the source of strcpy, I don't think it is in the distribution. They include the standard libraries, pre-compiled. For example, if you look in:
(install location)/hardware/tools/avr/avr/lib

You will see various pre-compiled libraries, for example:
libc.a
libm.a
libprintf_flt.a
libprintf_min.a
libscanf_flt.a
libscanf_min.a

To find the source you would need to find where the AVR source of libc is (possibly at http://www.nongnu.org/avr-libc/).

As for the Mac, all this stuff is a few levels down in the "Application Package" which you can view by right-clicking and selecting "Show Package Contents". Look in the Contents/Resources/Java folder.

None of these places are where you should put your own libraries (ones you write or download). They should go into the libraries folder which is a subdirectory of your sketchbook folder. Create the libraries folder if it does not exist. That way user-installed libraries persist from one version of the IDE to the next.

user59512: The arduino source files can be found on Github at https://github.com/arduino/Arduino, however the libraries have been moved to their own repositories:

https://github.com/arduino/ArduinoCore-avr
https://github.com/arduino/ArduinoCore-sam
https://github.com/arduino/ArduinoCore-samd


user313: On a Mac, the path to the source code folder is:
Arduino.app/Contents/Resources/Java/Hardware/Arduino/Cores/Arduino. I'd expect it would be the same from /Java/ on down in other OSes.


user368: The base Arduino source files are in the Arduino installation, under cores/arduino/. Source for additional libraries included are in libraries/.

user136: The code is also available online for those times you don't have the IDE installed:
https://github.com/arduino/Arduino

220: <p>I've been looking for a while inside Arduino's files to find the core library. However, I haven't found them yet. <strong>Where on my hard drive can I obtain the core library files (.cpp and .h) necessary for all Arduino code?</strong></p>

<p>Looking around on Google, I couldn't find a way to find the above files. I did see something about getting an .a file while Arduino is compiling, however, that isn't what I want. I want to browse the code and look at functions such as delay to see how they would react when given the values not expected. (i.e. Will my code stall if I use <code>delay(-200);</code> by not being to exit the loop, or will it create a black hole and disrupt the space-time continuum?)</p>
 80026: <p>I think this may have changed in newer versions. On my Mac Big Sur, Arduino 1.8.15 they are here: <code>/Applications/Arduino.app/Contents/Java/libraries</code></p>
 10794: <p>There are multiple places where you can look. As at IDE 1.6.4 (Ubuntu version) some are in:</p>

<pre><code>(install location)/libraries
</code></pre>

<p>But these are the high-level libraries, in particular:</p>

<pre><code>Bridge
Esplora
Ethernet
Firmata
GSM
LiquidCrystal
Robot_Control
RobotIRremote
Robot_Motor
SD
Servo
SpacebrewYun
Stepper
Temboo
TFT
WiFi
</code></pre>

<hr>

<p>That does not cover the low-level libraries like Tone, Print, main, etc. These are in:</p>

<pre><code>(install location)/hardware/arduino/avr/cores/arduino
</code></pre>

<p>There you would find the Arduino core libraries like:</p>

<pre><code>abi.cpp
Arduino.h
binary.h
CDC.cpp
Client.h
HardwareSerial0.cpp
HardwareSerial1.cpp
HardwareSerial2.cpp
HardwareSerial3.cpp
HardwareSerial.cpp
HardwareSerial.h
HardwareSerial_private.h
HID.cpp
hooks.c
IPAddress.cpp
IPAddress.h
main.cpp
new.cpp
new.h
Printable.h
Print.cpp
Print.h
Server.h
Stream.cpp
Stream.h
Tone.cpp
Udp.h
USBAPI.h
USBCore.cpp
USBCore.h
USBDesc.h
WCharacter.h
WInterrupts.c
wiring_analog.c
wiring.c
wiring_digital.c
wiring_private.h
wiring_pulse.c
wiring_shift.c
WMath.cpp
WString.cpp
WString.h
</code></pre>

<hr>

<p>However even that does not locate things like strcpy. The <strong>header</strong> files for them can be found at:</p>

<pre><code>(install location)/hardware/tools/avr/avr/include/
</code></pre>

<p>There you will find:</p>

<pre><code>alloca.h
assert.h
ctype.h
errno.h
inttypes.h
math.h
setjmp.h
stdfix-avrlibc.h
stdint.h
stdio.h
stdlib.h
string.h
</code></pre>

<hr>

<p>Even that is not the full story. In a subdirectory (avr) you will find the avr-related things, with files for different processors, such as (in part):</p>

<pre><code>boot.h
builtins.h
common.h
cpufunc.h
crc16.h
delay.h
eeprom.h
fuse.h
interrupt.h
io1200.h
io2313.h
...
iox64d4.h
iox8e5.h
lock.h
parity.h
pgmspace.h
portpins.h
power.h
sfr_defs.h
signal.h
signature.h
sleep.h
version.h
wdt.h
xmega.h
</code></pre>

<hr>

<p>As for the source of strcpy, I don't think it is in the distribution. They include the standard libraries, pre-compiled. For example, if you look in:</p>

<pre><code>(install location)/hardware/tools/avr/avr/lib
</code></pre>

<p>You will see various pre-compiled libraries, for example:</p>

<pre><code>libc.a
libm.a
libprintf_flt.a
libprintf_min.a
libscanf_flt.a
libscanf_min.a
</code></pre>

<p>To find the source you would need to find where the AVR source of libc is (possibly at <a href="http://www.nongnu.org/avr-libc/" rel="nofollow">http://www.nongnu.org/avr-libc/</a>).</p>

<hr>

<p>As for the Mac, all this stuff is a few levels down in the "Application Package" which you can view by right-clicking and selecting "Show Package Contents". Look in the <code>Contents/Resources/Java</code> folder.</p>

<hr>

<p><strong>None</strong> of these places are where you should put your <strong>own</strong> libraries (ones you write or download). They should go into the <code>libraries</code> folder which is a subdirectory of your <code>sketchbook</code> folder. Create the <code>libraries</code> folder if it does not exist. That way user-installed libraries persist from one version of the IDE to the next.</p>
 59512: <p>The arduino source files can be found on Github at <a href="https://github.com/arduino/Arduino" rel="nofollow noreferrer">https://github.com/arduino/Arduino</a>, however the libraries <a href="https://github.com/arduino/Arduino/tree/master/hardware#cores-have-been-moved" rel="nofollow noreferrer">have been moved</a> to their own repositories:</p>

<ul>
<li><a href="https://github.com/arduino/ArduinoCore-avr" rel="nofollow noreferrer">https://github.com/arduino/ArduinoCore-avr</a></li>
<li><a href="https://github.com/arduino/ArduinoCore-sam" rel="nofollow noreferrer">https://github.com/arduino/ArduinoCore-sam</a></li>
<li><a href="https://github.com/arduino/ArduinoCore-samd" rel="nofollow noreferrer">https://github.com/arduino/ArduinoCore-samd</a></li>
</ul>
 313: <p>On a Mac, the path to the source code folder is:<br>
<code>Arduino.app/Contents/Resources/Java/Hardware/Arduino/Cores/Arduino</code>. I'd expect it would be the same from <code>/Java/</code> on down in other OSes.</p>

<p><img src="https://i.stack.imgur.com/pY7yE.png" alt="Path to library sources (Arduino-Mac)"></p>
 368: <p>The base Arduino source files are in the Arduino installation, under <a href="https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino" rel="nofollow noreferrer"><code>cores/arduino/</code></a>. Source for additional libraries included are in <a href="https://github.com/arduino/ArduinoCore-avr/tree/master/libraries" rel="nofollow noreferrer"><code>libraries/</code></a>.</p>
 136: <p>The code is also available online for those times you don't have the IDE installed:</p>

<p><a href="https://github.com/arduino/Arduino">https://github.com/arduino/Arduino</a></p>
