0
#include <stdio.h>
int main()
{
unsigned long long num = 1073741824;
printf("num: %d\n", num);
printf("num * 2: %d\n", num * 2);
printf("num * 4: %d\n", num * 4);
return 0;
}
With this code the number will be printed in the 1st print, in the 2nd it will be negative and in the 3rd it Zera.
In the problem I need to store a value greater than 2 33
The
%d
is for numbers with signs, no? The correct would not be%u
forunsigned
?– Guilherme Nascimento
Use the formatter
"%llu"
– Augusto Vasques
@Augustovasques Oh, yes! Great, I just read this :) ps: maybe related https://stackoverflow.com/a/6400404/1518921
– Guilherme Nascimento
Orcboolg I think the table will help https://www.cplusplus.com/reference/cstdio/printf/ cc @Augustovasques
– Guilherme Nascimento