I am trying to multiply four integers into a __int64
. The value it should have is 4096 * 1024 * 64 * 64 = 17,179,869,184
. This is too large of a number to store in an int
, thats why I'm using __int64
.
The output I get however is 0
.
I've tried casting every single one of the integers to a __int64
, which doesnt change the output from being 0
.
Also, if I check with a debugger, the value of test
is in fact 0
, so it is not a problem with outputting it.
#include <stdio.h>
#include <stdlib.h>
int main() {
__int64 test = (__int64)4096 * (__int64)1024 * (__int64)64 * (__int64)64;
printf("%d", test);
getchar();
}
The output:
0
The expected output:
17179869184