What does this mean and how do I declare an array that holds 32-bit unsigned integer in C?
Printable View
What does this mean and how do I declare an array that holds 32-bit unsigned integer in C?
unsigned long int foo;
This should be at least 32 bits.
What makes an unsigned int any different from a normal int?
That is all explained in every C book there is....or else theres tons of articles about it on the net
So unsigned only allows positive numbers?
unsigned numbers are cryptographically insecure versions of signed numbers :rolleyes:
Ha ha!Quote:
Originally Posted by Salem
Basically, let's say you have an 8-bit int. On most computers one of the bits keeps track of the sign: 01100101. If the bold bit is 1 the number is negative, otherwise it's positive. Unsigned ints don't do this.
Since unsigned variables only allow whole numbers (positive (natural) numbers and zero), the extra bit that in signed numbers indicates the sign is part of the number. This means that you can numbers about twice as large in unsigned variables. eg
Code:unsigned char: 0 - 255
signed char: -127 - 127
unsigned short: 0 - 65535
signed short: -32767 - 32767