codegurukool.com · Free coding tutorials & online compiler

Home › C Tutorial › C fixed-width integers

C fixed-width integers

Exact sizes with stdint.h.

int8_t, uint16_t, int32_t, uint64_t have the same size on every platform.

Example code

#include <stdio.h>
#include <stdint.h>
int main() {
  uint8_t x = 255; x++;
  int32_t y = 100000;
  printf("%u %d %zu\n", x, y, sizeof(int64_t));
  return 0;
}

Run this code in the online editor

← C bitwise operatorsC command-line arguments →