Mask-group

Integers - Signed and Unsigned



  • When we know that there will be no sign with the integer,we can declare it as an unsigned integer.

Unsigned int Studentnum:

  • By doing this,the range of integers will shift from range -32768 to +32767 to the range 0 to 65535.

  • We can also have unsigned short int and unsigned long int as well.

  • By default a short int is signed short int and a long int is a signed long int.

Floats and Doubles:

  • A float occupies 4 bytes in memory.If this is not sufficient,we also have a double data type which occupies 8 bytes in memory.
  • A variable of double data type is declared as:
  1. double a:

C language also has a long double which occupies 10 bytes in memory.

  1. Chars - signed and unsigned:

As we have signed and unsigned integers we can also have signed and unsigned chars,both occupying 1 byte of memory but have different ranges.

A signed char is the same as ordinary char and has a range from -128 to +127.

An unsigned char has a range from 0 to 255.