Fixed widths#
The portable arithmetic types live in <stdint.h>. The
operator writes these by default for anything beyond local
counters.
#include <stdint.h>
int8_t a; uint8_t b;
int16_t c; uint16_t d;
int32_t e; uint32_t f;
int64_t g; uint64_t h;
The size-flavoured semantics types.
intptr_t ip; /* signed integer wide enough to hold a pointer */
uintptr_t up;
size_t n; /* unsigned, wide enough for any array index */
ptrdiff_t d2; /* signed, the difference between two pointers */
Format specifiers for these are in <inttypes.h>.
#include <inttypes.h>
uint64_t v = 1234;
printf("%" PRIu64 "\n", v);
References#
Primitives for the unsized integer types these portable types replace.