Category:C: Difference between revisions
m
→Types
(→Versions: Updated info re C2x.) |
Puppydrum64 (talk | contribs) m (→Types) |
||
Line 117:
===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. This is not an exhaustive list. Some of these names will have different meanings depending on the hardware you're programming for.
* <code>char</code>: an 8 bit value, typically used to represent ASCII characters.
* <code>short</code>: a 16 bit value.
Line 123:
* <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 single-precision (32-bit) floating-point decimal value.
You can also add a few modifiers in front of the variable type to be more specific:
Line 133:
volatile int HorizontalScroll;</lang>
Functions
<lang C>int foo(int bar);
// The function foo was declared. It takes an integer as an argument and returns an integer.
|