-->

Saturday, July 6, 2019

Constants in C

Constants

A constants in C is fixed value which not alter during execution of program.
Constants can be any of the basic datatype like an integer constants ,floating constants ,or string constants.

constants are also known as Literals.

Integer constants

Integer constants can be hexadecimal, decimal,or octal.
Integer constants can also have a suffix that is a combination 
of U and L , for unsigned and long .

Rules for constructing Integer constants

  1. It must have at least one digit .
  2. It does not allow   blank,commas within constant.
  3. It sign is Positive.
  4. Its range for integer constants is depends upon the compiler 
        i.e,compiler like visual studio and GCC is -2147483 to               +2147483  ,and  for Turbo C++ range is -32768 to +32767.

floating constants / Real constants

In simple word it contains decimal value of constants.
it can be written into two form : 
  1. Fractional form.
  2. Exponential form.

Rules for constructing Real constants

  1. It must have at least one digit .






Constants in C
Constants in C










       < previous page                                                                             Next page >



     

    0 Comments:

    Post a Comment