I am trying to print out these variables from the limits.h file, and all of them work, except the ULONG_MAX variable. It keeps printing out as 9223372036854775807
rather than 18446744073709551615
. Not quite sure what is wrong here - I am pretty new to C.
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main(int argc,char **argv) {
printf("Value 8 16 32 64\n");
printf("UMax 0xFF 0xFFFF 0xFFFFFFFF 0xFFFFFFFFFFFFFFFF\n");
printf(" %d %d %u %u\n", UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX);
return 0;
}
User contributions licensed under CC BY-SA 3.0