Reputation: 1583
The unsigned long long
type doesn't work as expected for me. Here's my simple code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
unsigned long long a = 2932306814;
printf("a = %d\n", a);
return EXIT_SUCCESS;
}
I get the following output:
a = -1362660482
The used gcc
was installed as part of mingw and has version 4.8.1.
Upvotes: 0
Views: 82
Reputation: 4230
You are not printing the number correctly. %d
specifier is for an int
. Use the specifier %llu
for an unsigned long long
.
Change to:
printf("a = %llu\n", a);
Upvotes: 3