Recently I have had the need to run loops of at least 10^10 steps.
Since 32 bit integers apparently can only store values up to about
2*10^9, I have tried to use the "long long" data type. However, it has
not worked and I am unsure why. For example, I try the following code:
testlong.c:
#include <stdio.h>
#include <stdlib.h>
int main() {
long long a;
a = 10000000000LL; //10^10
printf("a = %i\n", a);
return EXIT_SUCCESS;
}
and compile it by:
gcc testlong.c -o testlong
then when I run the executable I obtain the following:
a = 1410065408
Does anyone know how to fix this problem? Perhaps gcc requires some
commandline argument to support long long ints?
Thanks for any suggestions.