Although C does not define either a range or a size in memory for these variants, it is safe to assume that a variable declared to be long has at least as large a range and occupies at least as much memory as an int. Similarly a short occupies no more memory and has no larger a range than an int;
The use of unsigned variables is usually when an integral value is intended to represent a bit pattern. The unsigned variants are usually capable of representing a larger range of positive values than their signed equivalent,
As with the variants of integral values, C does not force a particular set of ranges or representations to correspond to these variants; it is safe to assume that the variants double and long double will be no smaller in range or size than float;
strictly speaking the C char type is simply the smallest possible variant of the integral value family; it is defined to represent the memory unit capable and normally used to hold a character value;
Examples of declarations are
int IntVal; /*Declares one integer variable, IntVal*/ float RVal1, RVal2; /*Declares 2 real variables, RVal1 & RVal2*/ char Operator; /*Declares one char variable, Operator*/
Note that each declaration may define one or more variables of the same type.
Exercises on this section.
Back to Contents page.