Trying to print a long
in C++ on 32-bit machine. I'm getting an unexpected output.
From this code:
long n = 5330111323L;
printf("n = %ld\n", n);
printf("can print? %s\n", LONG_MAX < 5330111323L ? "yes" : "NO");
printf("LONG_MAX = %ld\n", LONG_MAX);
I'm getting this:
The C# output is fine.
This:
long n = 5330111323L;
Console.WriteLine(n);
print:
5330111323
Both use 32-bit compilers. Why am I getting this C++ output?