I would like to return a uint64_t
but the result seems truncated:
In lib.c
:
uint64_t function()
{
uint64_t timestamp = 1422028920000;
return timestamp;
}
In main.c
:
uint64_t result = function();
printf("%llu = %llu\n", result, function());
The result:
394745024 = 394745024
At compilation, I get a warning:
warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'uint64_t' [-Wformat]
warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'int' [-Wformat]
Why is the compiler thinking that the return type of my function is an int
? How can we explain that the reslut printed is different from the value sent by the function function()
?