I'm using Codeblocks and the GNU compiler on a Windows computer. When the compiler runs, it does so under the following conditions:
mingw32-gcc.exe -Wall -g -std=c11 <filename> -o obj\Debug\main.o
My code is as follows:
#include <stdio.h>
#include <limits.h>
int main()
{
printf("INTEGER min: %d\n", INT_MIN);
printf("INTEGER max: %d\n\n", INT_MAX);
printf("UNSIGNED INTEGER max: %u\n\n", UINT_MAX);
printf("LONG INTEGER min: %ld\n", LONG_MIN);
printf("LONG INTEGER max: %ld\n\n", LONG_MAX);
//printf("LONG LONG INTEGER min: %lld\n", LONG_LONG_MIN);
//printf("LONG LONG INTEGER max: %lld\n\n", LONG_LONG_MAX);
printf("UNSIGNED LONG INTEGER max: %lu\n\n", ULONG_MAX);
//printf("UNSIGNED LONG LONG INTEGER max: %lld\n", ULONG_LONG_MAX);
printf("\n");
return 0;
}
My output for this code:
INTEGER min: -2147483648
INTEGER max: 2147483648
UNSIGNED INTEGER max: 4294967295
LONG INTEGER min: -2147483648
LONG INTEGER max: 2147483648
UNSIGNED LONG INTEGER max: 4294967295
The lines referring to LONG LONG integers are commented out because the compiler was giving errors:
error: 'LONG_LONG_MIN' undeclared (first use in this function)
error: 'LONG_LONG_MAX' undeclared (first use in this function)
error: 'ULONG_LONG_MAX' undeclared (first use in this function)
However, while typing the code, CodeBlocks provided code hinting indicating that I could, in fact, use the LONG_LONG constants. Hence, I need answers for the following questions:
- Why do the integers and long integers have the same limits? Shouldn't the long integers have a larger range of values?
- Why am I having trouble with the LONG_LONG constants? Does this mean I can't use long long integers?
Thanks