int64_t --Signed 64-bit integer type

"Int64_t" is a signed 64-bit integer type. It can be used by including the " stdint.h" header. This is the type introduced in C99.

# Signed 64-bit integer type
int64_t

The maximum value of an integer that can be represented by a signed 64-bit integer type is "9223372036854775807", and the minimum value is "-9223372036854775808".

The maximum value is " INT64_MAX" and the minimum value is " INT64_MIN". It is defined.

int64_t sample code

This is a sample code using int64_t.

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

int main (void) {
  int64_t num = -9223372036854775808LL;
  
  printf("%lld\n", num);
}

I am using "%lld" in the format specifier of the printf function.

The integer literal suffix is ​​"LL" and the format specifier is "%lld" so that everything works correctly on Unix / Linux / Mac / Windows. This is because "L" and "%ld" mean signed 32-bit integers in Windows. "LL" and "%lld" are used to guarantee signed 64-bit integers.

Output result.

-9223372036854775808

Associated Information