There are no notfications.

Data types (x86-64)

The C language standard does not specify in absolute terms the size of its primitive data types. The information in this chapter applies specifically to the following software and hardware:

The code to generate the information in this chapter can be obtained here.

Integers

It is advisable to use stdint.h as a replacement for the sake of specificity.

Signed

Name Range Size Literal Constants Format specifier
Minimum Maximum
signed char −128 127 1 byte
8 bits
(name)value SCHAR_MIN SCHAR_MAX %hhi
short
short int
signed short
signed short int
−32,768 32,767 2 bytes
16 bits
(name)value SHRT_MIN SHRT_MAX %hi
int
signed
signed int
−2,147,483,648 2,147,483,647 4 bytes
32 bits
value INT_MIN INT_MAX %i
long
long int
signed long
signed long int
−9,223,372,036,854,775,808 9,223,372,036,854,775,807 8 bytes
64 bits
Value suffix l or L LONG_MIN LONG_MAX %li
long long
long long int
signed long long
signed long long int
Value suffix ll or LL LLONG_MIN LLONG_MAX %lli

Unsigned

Name Range Size Literal Constants Format specifier
Minimum Maximum
unsigned char 0 255 1 byte
8 bits
(name)value None UCHAR_MAX %hhu
unsigned short
unsigned short int
0 65,535 2 bytes
16 bits
(name)value None USHRT_MAX %hu
unsigned
unsigned int
0 4,294,967,295 4 bytes
32 bits
Value suffix u or U None UINT_MAX %u
unsigned long
unsigned long int
0 18,446,744,073,709,551,615 8 bytes
64 bits
Value suffix ul or UL None ULONG_MAX %lu
unsigned long long
unsigned long long int
Value suffix ull or ULL None ULLONG_MAX %llu

Floating-point numbers

It is not advisable to use float_t and double_t which are declared in math.h as replacements.

Name Range Size Literal Constants Format specifier
Minimum Maximum printf1 scanf2
float 1.175494E−38 3.402823E+38 4 bytes
32 bits
Value suffix f or F FLT_MIN FLT_MAX None3 %f
double 2.225074E−308 1.797693E+308 8 bytes
64 bits
value DBL_MIN DBL_MAX %f %lf
long double 3.362103E−4932 1.189731E+4932 16 bytes
128 bits
Value suffix l or L LDBL_MIN LDBL_MIN %Lf %Lf

1 Also fprintf, snprintf, sprintf, vfprintf, vprintf, vsnprintf and vsprintf.
2 Also fscanf, sscanf, vfscanf, vscanf and vsscanf.
3 float is promoted to double (%f).

Character

The character char is an integer data type but is primarily used to represent typographical symbols.

Name Range Size Literal Constants Format specifier
Minimum Maximum
char −128 127 1 byte
8 bits
'character_value' or integral_value CHAR_MIN CHAR_MAX None*

* char is the same as signed char (%hhi). Typographical representation: %c for character and %s for string (pointer to char).

Boolean

The boolean _Bool is an integer data type but the compiler will not allow it to be set to any value outside its range. It is advisable to use stdbool.h as a replacement for the sake of clarity.

Name Range Size Literal Format specifier
_Bool 0 1 1 byte
8 bits
value None*

* _Bool is promoted to int (%i).

Miscellaneous

stdbool.h

The stdbool.h header declares macros for the _Bool data type.

Name Range Size Literal Format specifier Primitive equivalent
bool false true 1 byte
8 bits
value None* _Bool

* bool is promoted to int (%i).

stddef.h

The stddef.h header declares a type definition for the return type of the sizeof operator.

Name Range Size Literal Constants Format specifier Primitive equivalent
Minimum Maximum
size_t 0 18,446,744,073,709,551,615 8 bytes
64 bits
Value suffix ul or UL None SIZE_MAX %zu unsigned long
unsigned long int

stdint.h

The stdint.h header declares type definitions and macros for the integer primitives.

Signed

Name Range Size Literal macro Constants Format specifier macro Primitive equivalent
Minimum Maximum printf1 scanf2
int8_t −128 127 1 byte
8 bits
INT8_C(value) INT8_MIN INT8_MAX PRId8 / PRIi8 SCNi8 signed char
int16_t −32,768 32,767 2 bytes
16 bits
INT16_C(value) INT16_MIN INT16_MAX PRId16 / PRIi16 SCNi16 short
short int
signed short
signed short int
int32_t −2,147,483,648 2,147,483,647 4 bytes
32 bits
INT32_C(value) INT32_MIN INT32_MAX PRId32 / PRIi32 SCNi32 int
signed
signed int
int64_t −9,223,372,036,854,775,808 9,223,372,036,854,775,807 8 bytes
64 bits
INT64_C(value) INT64_MIN INT64_MAX PRId64 / PRIi64 SCNi64 long
long int
signed long
signed long int

1 Also fprintf, snprintf, sprintf, vfprintf, vprintf, vsnprintf and vsprintf.
2 Also fscanf, sscanf, vfscanf, vscanf and vsscanf.

Unsigned

Name Range Size Literal macro Constants Format specifier macro Primitive equivalent
Minimum Maximum printf1 scanf2
uint8_t 0 255 1 byte
8 bits
UINT8_C(value) None UINT8_MAX PRIu8 SCNu8 unsigned char
uint16_t 0 65,535 2 bytes
16 bits
UINT16_C(value) None UINT16_MAX PRIu16 SCNu16 unsigned short
unsigned short int
uint32_t 0 4,294,967,295 4 bytes
32 bits
UINT32_C(value) None UINT32_MAX PRIu32 SCNu32 unsigned
unsigned int
uint64_t 0 18,446,744,073,709,551,615 8 bytes
64 bits
UINT64_C(value) None UINT64_MAX PRIu64 SCNu64 unsigned long
unsigned long int

1 Also fprintf, snprintf, sprintf, vfprintf, vprintf, vsnprintf and vsprintf.
2 Also fscanf, sscanf, vfscanf, vscanf and vsscanf.