C provides a wide range of variable types.
All of the integer types plus the char are called the integral types. float and double are called the real types.
Declarations can be spread out, allowing space for an explanatory comment. Variables can also be initialised when they are declared, this is done by adding an equals sign and the required value after the declaration.
int high = 250; /* Maximum Temperature */
int low = -40; /* Minimum Temperature */
int results[20]; /* Series of temperature readings */
Type
|
Explanation
|
int
|
An Integer
|
float
|
A floating point (real) number
|
char
|
A single byte of memory, enough to hold a character
|
short
|
An integer, possibly of reduced range
|
long
|
An integer, possibly of increased range
|
unsigned
|
An integer with no negative range, the spare capacity being
used to increase the positive range
|