Thursday, January 7, 2016

Other Basic Type Specifiers

  • Signed : 'signed' specifier helps us to declare signed integer or character type variable, which can hold positive as well as negative values. By default integer and character type variables are signed.
  • Unsigned : On the other hand, 'unsigned' qualifier helps us to declare variables which can hold only positive values starting from 0. If you are working with values that can’t be less than 0 like the number of cars or visitor count, you should use 'unsigned' as it gives one extra benefit. Declaring an int as unsigned can it able to hold up to double the maximum value supported by int.
  • Long and Short :'Long' and 'short' specifier enables us to declare integers and double (only long specifier supported with double, short is not supported) with different lengths. Short integers are 16 bit long and have -32768 to 32767 range. Long integers have greater range -2147483647 to +2147483647.

No comments: