C Data Types - Basic Types

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:

    When you realize how hard it is to know the truth about yourself, you understand that even the most exhaustive and well-meaning autobiography, determined to tell the truth, represents, at best, a guess. There have been times in my life when I felt incredibly happy. Life was full. I seemed productive. Then I thought,”Am I really happy or am I merely masking a deep depression with frantic activity?” If I don’t know such basic things about myself, who does?
    Phyllis Rose (b. 1942)

    As for types like my own, obscurely motivated by the conviction that our existence was worthless if we didn’t make a turning point of it, we were assigned to the humanities, to poetry, philosophy, painting—the nursery games of humankind, which had to be left behind when the age of science began. The humanities would be called upon to choose a wallpaper for the crypt, as the end drew near.
    Saul Bellow (b. 1915)