[Solved] how to represent number bigger than long in c [duplicate]


Use integer type long long.
It is good for at least the range -9223372036854775807 <= x <= +9223372036854775807.

#include <stdio.h>
int main(int argc, char *argv[]) {
  long long big = 600851475143;
  printf("%lld\n", big);  // prints 600851475143
  return 0;
}

Alternatively, one could use int64_t or uint64_t – 64-bit types.


The range mentioned above is the minimal range specified in C11 5.2.4.2.1.

0

solved how to represent number bigger than long in c [duplicate]