Friday , 24 May 2019
Breaking News

C Integer Constants

An integer constant refers to a sequence of digits without decimal point.

Rule for constructing integer constants are :

  1. An integer constant must have at least one digit .
  2. An integer constant contains neither a decimal point nor an exponent.
  3. Commas and blank Spaces cannot be included within the number.
  4. Sign ( + or – ) must precede the number .
  5. Default sign is positive .
  6. The allowable range for integer constants for a 16 bit computer is – 32768 to + 32767

There are three type of integer constants , namely , decimal , octal and hexadecimal.

( a ) Decimal integers consists of a set of digits 0 through 9 .

Example : The following are valid decimal integer constants

18                    – 11                    +39            0              8752

On the other hand , the following are not valid integer constants

28.0              contains a decimal point

12,250          contains a comma

5-                  Sign does not precede

40 20            Blank spaces are not allowed

( b )  An octalinteger constant consists of any combination of digits from 0 through 7 , with a leading 0.

Example : The following are valid octal integer Constants

015          0375           0            0764            05

( c )   A hexadecimal integer constant consists of any combination of digits from 0 through 9 or alphabets a ( or A ) through f ( or F ) , with a leading 0x or 0X .

Example : The following are valid hexadecimal integer constants

0x5           0x7ab          0x6f          0xabc        0x975

We generally use decimal integer constant or simply integer constant in programming.

Check Also

चौथी पीढ़ी की भाषाएँ

चौथी पीढ़ी की भाषाएँ ( Fourth Generation Languages – 4th GL ) तीसरी पीढ़ी की …

Leave a Reply

Your email address will not be published. Required fields are marked *