Basic Types
The C language provides many basic types. Most of them are formed from one of the four basic arithmetic type identifiers in C (char
, int
, float
and double
), and optional specifiers (signed
, unsigned
, short
, long
). All available basic arithmetic types are listed below:
Type | Explanation | Type | Explanation |
---|---|---|---|
char | smallest addressable unit of the machine that can contain basic character set. It is an integer type. Actual type can be either signed or unsigned depending on implementation | signed char | same as char , but guaranteed to be signed. |
unsigned char | same as char , but guaranteed to be unsigned. |
||
short short int signed short signed short int |
short signed integer type. At least 16 bits in size. | unsigned short unsigned short int |
same as short , but unsigned. |
int signed int |
basic signed integer type. At least 16 bits in size. | unsigned unsigned int |
same as int , but unsigned. |
long long int signed long signed long int |
long signed integer type. At least 32 bits in size. | unsigned long unsigned long int |
same as long , but unsigned. |
long long long long int signed long long signed long long int |
long long signed integer type. At least 64 bits in size. Specified since the C99 version of the standard. | unsigned long long unsigned long long int |
same as long long , but unsigned. Specified only in C99 version of the standard. |
float | (single precision) floating-point type. Actual properties unspecified, however on most systems this is IEEE 754 single precision floating point format. | ||
double | double precision floating-point type. Actual properties unspecified, however on most systems this is IEEE 754 double precision floating point format. | ||
long double | extended precision floating-point type. Actual properties unspecified. Unlike types float and double, it can be either 80-bit floating point format, the non-IEEE "double-double" or IEEE 754 quadruple precision floating-point format if a higher precision format is provided, otherwise it is the same as double. See this page for details. |
The actual size of integer types varies by implementation. The only guarantee is that the long long
is not smaller than long
, which is not smaller than int
, which is not smaller than short
. Also, int
should be the integer type that the target processor is most efficient working with. This allows great flexibility: for example, all types can be 64-bit. However, only several different integer width schemes (data models) are popular and since data model defines how different programs communicate, a uniform data model is used within a given operating system application interface.
The actual size of floating point types also varies by implementation. The only guarantee is that the long double
is not smaller than double
, which is not smaller than float
. Usually, 32-bit and 64-bit IEEE 754 floating point formats are used, if supported by hardware.
Read more about this topic: C Data Types
Famous quotes containing the words basic and/or types:
“The basic Female body comes with the following accessories: garter belt, panti-girdle, crinoline, camisole, bustle, brassiere, stomacher, chemise, virgin zone, spike heels, nose ring, veil, kid gloves, fishnet stockings, fichu, bandeau, Merry Widow, weepers, chokers, barrettes, bangles, beads, lorgnette, feather boa, basic black, compact, Lycra stretch one-piece with modesty panel, designer peignoir, flannel nightie, lace teddy, bed, head.”
—Margaret Atwood (b. 1939)
“The American man is a very simple and cheap mechanism. The American woman I find a complicated and expensive one. Contrasts of feminine types are possible. I am not absolutely sure that there is more than one American man.”
—Henry Brooks Adams (18381918)