Category:C: Difference between revisions

Content added Content deleted
No edit summary
Line 116: Line 116:


===Types===
===Types===
C has the following types built in by default, but you can create your own based on these using the <code>typedef</code> directive.
C has the following types built in by default, but you can create your own based on these using the <code>typedef</code> directive. This is not an exhaustive list.
* char: an 8 bit value, typically used to represent ASCII characters.
* <code>char</code>: an 8 bit value, typically used to represent ASCII characters.
* short: a 16 bit value.
* <code>short</code>: a 16 bit value.
* int: a 32 bit value.
* <code>int</code>: a 32 bit value.
* <code>struct</code>: a collection of several other values, stored consecutively in memory. Each can be a different type.
* <code>union</code>: a variable that can hold several different types of data, but only one at a time.
* <code>float</code>: a floating-point decimal value.


You can also add a few modifiers in front of the variable type to be more specific:
You can also add a few modifiers in front of the variable type to be more specific: