Tuesday, March 11, 2025

C Language Constants and Variables

 

                                                    Constant & Variables                                                                        


Constant
                     

    Numeric Constants                                                                                        Non-Numeric

Integers (int)               float                                                      character (char)              String

0 1 2 -2 4 5                   0.0 0.1 1.0                                         within Single quote      Within Double quote

256, -786, 654 etc      -1.0 0.0001                                           Single character.           More than one                                            2.34   2.1E+12   2.1E-12                                                                        character.

                                     -2.1E+12                                           ' ' 'a'  'A'    '9' '+'             "     "    "Khammam"

                                                                                                    't'  '#'                     "Rama Rao" "10-5-46"                                                                                                                                                                                                                                                                                                               "a+b"     "5+9"


    Variables

Variables : Name of the constants. 

Rules

-A Variables start with any alphabet

-followed by any alphabet or numerics

-Not allowed the special sysmbols, except underscore( _ )

-Do not use keyword as a Variable.

-Maximum size in MSDOS, 36 charactrs.  unlimit in UNIX OS.

-Case differnt.  ex. AB    ab     Ab    aB

ex.     a  b  c  d    abcd    r root     r1  root1     r2   root2     Address

area    volume    si ci hno street  city    pincode     sname         book_name

area_of_circle  x      y       z





No comments:

Post a Comment