DIFFERENT TYPES OF INTEGERS
A normal integer is limited in range to +-32767. This value differs from computer to computer. It is possible in C to specify that an integer be stored in four memory locations instead of the normal two. This increases the effective range and allows very large integers to be stored. The way in which this is done is as follows,
long int big_number = 245032L;To display a long integer, use %l, ie,
printf("A larger number is %l\n", big_number );Short integers are also available, eg,
short int small_value = 114h; printf("The value is %h\n", small_value);Unsigned integers (positive values only) can also be defined.
Type: int Integer data type Variables of type int are one word in length. They can be signed (default) or unsigned, which means they have a range of -32768 to 32767 and 0 to 65535, respectively. Type modifiers: signed, unsigned, short, long A type modifier alters the meaning of the base type to yield a new type. Each of the above can be applied to the base type int. The modifiers signed and unsigned can be applied to the base type char. In addition, long can be applied to double. When the base type is ommitted from a declaration, int is assumed. Examples: long x; /* int is implied */ unsigned char ch; signed int i; /* signed is default */ unsigned long int l; /* int ok, not needed */