C Data Types


C data types referance guide

Type     Explanation Minimum size (bits) Format specifier
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. 8 %c
signed char Of the same size as char, but guaranteed to be signed. Capable of containing at least the [−127, +127] range. 8 %c (or %hhi for numerical output)
unsigned char Of the same size as char, but guaranteed to be unsigned. Contains at least the [0, 255] range. 8 %c (or %hhu for numerical output)
short
short int
signed short
signed short int
Short signed integer type. Capable of containing at least the [−32,767, +32,767] range. 16 %hi or %hd
unsigned short
unsigned short int
Short unsigned integer type. Contains at least the [0, 65,535] range. 16 %hu
int
signed
signed int
Basic signed integer type. Capable of containing at least the [−32,767, +32,767] range. 16 %i or %d
unsigned
unsigned int
Basic unsigned integer type. Contains at least the [0, 65,535] range. 16 %u
long
long int
signed long
signed long int
Long signed integer type. Capable of containing at least the [−2,147,483,647, +2,147,483,647] range. 32 %li or %ld
unsigned long
unsigned long int
Long unsigned integer type. Capable of containing at least the [0, 4,294,967,295] range. 32 %lu
long long
long long int
signed long long
signed long long int
Long long signed integer type. Capable of containing at least the [−9,223,372,036,854,775,807, +9,223,372,036,854,775,807] range. Specified since the C99 version of the standard. 64 %lli or %lld
unsigned long long
unsigned long long int
Long long unsigned integer type. Contains at least the [0, +18,446,744,073,709,551,615] range. Specified since the C99 version of the standard. 64 %llu
float Real floating-point type, usually referred to as a single-precision floating-point type. Actual properties unspecified (except minimum limits); however, on most systems, this is the IEEE 754 single-precision binary floating-point format (32 bits). This format is required by the optional Annex F “IEC 60559 floating-point arithmetic”. %f %F
%g %G
%e %E
%a %A
double Real floating-point type, usually referred to as a double-precision floating-point type. Actual properties unspecified (except minimum limits); however, on most systems, this is the IEEE 754 double-precision binary floating-point format (64 bits). This format is required by the optional Annex F “IEC 60559 floating-point arithmetic”. %lf %lF
%lg %lG
%le %lE
%la %lA 1
long double Real floating-point type, usually mapped to an extended precision floating-point number format. Actual properties unspecified. It can be either x86 extended-precision floating-point format (80 bits, but typically 96 bits or 128 bits in memory with padding bytes), the non-IEEE “double-double” (128 bits), IEEE 754 quadruple-precision floating-point format (128 bits), or the same as double. See the article on long double for details. %Lf %LF
%Lg %LG
%Le %LE
%La %LA 1

  1. Uppercase differs from lowercase in the output. Uppercase specifiers produce values in the uppercase, and lowercase in lower ↩︎ ↩︎