On this page
  1. <stdint.h>, <stdbool.h> & <limits.h>
  2. Contents
  3. Portable Widths & Format Macros (<inttypes.h>)
  4. size_t, ptrdiff_t & uintptr_t

<stdint.h>, <stdbool.h> & <limits.h>

Prev: stdlib.h & string.h | Up: stdlib | Next: math, time & assert
Rel: Syntax, Types & Operators, Binary & Encodings
Ref: cppreference — Fixed Width Integer Types
Tags: #public #prog #c #stdlib #types


Contents


Portable Widths & Format Macros (<inttypes.h>)

Use <stdint.h> types for wire formats, binary files, and bit manipulation, paired with <inttypes.h> PRI* macros for portable printf:

#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

uint64_t bytes = 1048576ULL;
bool ready = true;
printf("bytes=%" PRIu64 " ready=%s\n", bytes, ready ? "true" : "false");

size_t, ptrdiff_t & uintptr_t

Linked from

Related notes