user8: There are several different types in the Arduino programming language. They each have different applications that can use up the limited RAM in the Arduino. When should i use each?

user8: An overview of the most commonly used variables:

byte: uses one byte (8 bits), holds numbers from 0 to 255
char: a signed byte
boolean: uses 1 byte, but only holds a value of true or false
int: uses 2 bytes, holds numbers from -32768 to 32767, mostly used in general programming. an int is what is known as a signed variable, where the last bit controls if it is negative or positive
long: uses 4 bytes, holds numbers from -2147483647 to 217283648, it is also signed
long long: uses 8 bytes, can hold -9223372036854775808 to 9223372036854775807, signed
float: uses 4 bytes, holds decimals from -3.4028235E+38 to 3.4028235E+38.
double: almost identical to float
string: an array of chars that represent text
String: not to be confused with string, this is a class that holds text data with extra functions

Most variable declarations can be prefixed with signed or unsigned to change the function of the sigh bit. For example, unsigned int x = 0; would create a variable that holds numbers from 0 to 65535 because the sign bit is used as an extra data bit.

user60: One should appreciate that the Arduino is an Embedded Processor. Specifically that it has limited resources of RAM and ROM(aka Flash/program space). 
Often is the case I see coding use the "int" defaultly. Almost sloppily. If that works great.
BUT!!!!
You can run out of room REAL FAST with only 2K of RAM.
I would recommend that you size down your type to the minimum of what it needs to be describing it. One also gets a better understanding of what it really is and its limitations. There is no need for an array of int(16bits) from bytes that were recieved from the SPI, UART or I2C. Or a matrix of RGB's that consume 3 bytes each, being int's. You cut your capacity in half.
The pro/con: PRO: using default int everywhere makes it more inter changeable. The CON is that such interchangeability can lead to unintentional casting errors. 
I would also recommend using C99 type def's which can be found at "avr_stdint.html">http://www.nongnu.org/avr-libc/user-manual/group_avr_stdint.html" and elsewhere. It makes things vivid, regards to this aspect. Hence a "int" would be a "int16_t", "unsigned long" be "uint32_t" etc...
It is worth knowing that in some cases a byte or char can not be replaced with int8_t, as such when used with string array functions. But they are still just as vivid.

8: <p>There are several different types in the Arduino programming language. They each have different applications that can use up the limited RAM in the Arduino. When should i use each?</p>
 8: <p>An overview of the most commonly used variables:</p>

<ul>
<li><strong>byte</strong>: uses one byte (8 bits), holds numbers from 0 to 255</li>
<li><strong>char</strong>: a signed byte</li>
<li><strong>boolean</strong>: uses 1 byte, but only holds a value of <code>true</code> or <code>false</code></li>
<li><strong>int</strong>: uses 2 bytes, holds numbers from -32768 to 32767, mostly used in general programming. an <code>int</code> is what is known as a signed variable, where the last bit controls if it is negative or positive</li>
<li><strong>long</strong>: uses 4 bytes, holds numbers from -2147483647 to 217283648, it is also signed</li>
<li><strong>long long</strong>: uses 8 bytes, can hold -9223372036854775808 to 9223372036854775807, signed</li>
<li><strong>float</strong>: uses 4 bytes, holds decimals from -3.4028235E+38 to 3.4028235E+38.</li>
<li><strong>double</strong>: almost identical to <code>float</code></li>
<li><strong>string</strong>: an array of chars that represent text</li>
<li><strong>String</strong>: not to be confused with <code>string</code>, this is a class that holds text data with extra <a href="http://arduino.cc/en/Reference/StringObject" rel="nofollow">functions</a></li>
</ul>

<p>Most variable declarations can be prefixed with <code>signed</code> or <code>unsigned</code> to change the function of the sigh bit. For example, <code>unsigned int x = 0;</code> would create a variable that holds numbers from 0 to 65535 because the sign bit is used as an extra data bit.</p>
 60: <p>One should appreciate that the Arduino is an Embedded Processor. <em>Specifically that it has limited resources of RAM and ROM(aka Flash/program space).</em> </p>

<p>Often is the case I see coding use the "int" defaultly. Almost sloppily. If that works great.</p>

<p>BUT!!!!
You can run out of room REAL FAST with only 2K of RAM.</p>

<p>I would recommend that you size down your type to the minimum of what it needs to be describing it. One also gets a better understanding of what it really is and its limitations. There is no need for an array of int(16bits) from bytes that were recieved from the SPI, UART or I2C. Or a matrix of RGB's that consume 3 bytes each, being int's. You cut your capacity in half.</p>

<p>The pro/con: PRO: using default int everywhere makes it more inter changeable. The CON is that such interchangeability can lead to unintentional casting errors. </p>

<p>I would also recommend using C99 type def's which can be found at "avr_stdint.html">http://www.nongnu.org/avr-libc/user-manual/group_<em>avr</em>_stdint.html" and elsewhere. It makes things vivid, regards to this aspect. Hence a "int" would be a "int16_t", "unsigned long" be "uint32_t" etc...</p>

<p>It is worth knowing that in some cases a byte or char can not be replaced with int8_t, as such when used with string array functions. But they are still just as vivid.</p>
