Primitives

Contents

Primitives#

The base set, with sizes you should not assume.

Type

Notes

char

1 byte. Signedness is implementation-defined; signed char and unsigned char are explicit.

short

at least 16 bits.

int

at least 16; typically 32 on every modern host.

long

at least 32. 32-bit on Windows x64; 64-bit on Linux x64.

long long

at least 64.

float

IEEE 754 single (almost everywhere).

double

IEEE 754 double.

long double

extended precision; 80-bit on x86, same as double elsewhere.

_Bool / bool

0 or 1. bool requires <stdbool.h> (or C23).

void

“no type”. void * is a generic pointer.

Sign forms.

signed   int n;
unsigned int u;
short    s;            /* signed short */
unsigned short us;
long long ll;
unsigned long long ull;

References#

  • Fixed widths for portable, fixed-width arithmetic types.

  • Casting for integer promotion rules.