#include <stdio.h>
int main(void)
{
long long x = test();
printf("%lld\n", x);
return 1;
}
long long test()
{
return 1111111111111111111;
}
The output is 734294471 . If I replace the call to test()
by a the number, the output is as I expect. I checked the value of x using a debugger and it wasn't set the to value returned by the function. What is going wrong?
I am using Visual Studio 2010 with the Visual C++ compiler.
You need to declare test
before you call it, otherwise C assumes it returns int
.