Re: Problem with 32 bit ints

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 05/30/98


On Sun, 31 May 1998, Chuck Carson wrote:

->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.

2^31 is the size for a signed integer (because the 32nd bit is used
for the sign).  Note, however, that %ld is for printing a signed
integer, not an unsigned.  Use "%lu".

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

Ehhh, '&'?

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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