Problem with 32 bit ints

From: Chuck Carson (chuck@EDEN.COM)
Date: 05/30/98

Okay, I have 3 C books and they are all vague on this.

First, this is being done on a RH 5 system with a pentium 200 cpu.

For some reason, I cannot get an unsigned long int to hold a value
greater than 2^31. I was under the assumption 4294967295 was the
max number you could represent as an integer.

Here is the segment of code I am trying:

unsigned long int x = 2147484000; // A little more than 2^31

printf("X = &ld\r\n", x);

I have tried setting a variable equal to UINT_MAX, but RH does
not know about UINT_MAX (is this obsolete?)

This just confuses me becase I have seen people on the list talk
about using unsigned long int's to hold values up to 2^32.

I have also tried declaring the variable as:

unsigned x;
unsigned int x;
long int x;

All with the same results.

Thanks, Chuck

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST