Wednesday, 20 September 2017

What are Constants & Identifiers in C #4

    

 Key Points :

CONSTANTS :-
                                The entity that does not change during the exicution of program is known as constants.
                                The constant value remain unchange all over the program.

                                There are mainly 3 types of constants.

                1] Integer const.
                2] Float const.
                3] Character const.

                1] Integer constant :-
                                All the integer values comes under the integer constant.
                                It is of 4 types.

                a) Binary int. const.     [0 & 1]

                       
                                Binary constants are the constants which are in 0 & 1 format.
                                                Ex. 0110, 1101.
                b) Octal int. const.      [0 - 7]
                                The constants contains set of digits between ' 0 to 7' are octal constants. '0' is
                                neccesary before writing octal constants.
                                                Ex. 023, 01.
                c) Decimal int. const.    [0 - 9]
                                The constants contains set of digits between ' 0 to 9' are decimal constants.
                                                Ex. 123, 65.
                d) Hexadecimal int. const.[0 - 15]
                                In hexadecimal digit the numbers after 9 are denoted by alphabets as follows-
                                A = 10                                                    B = 11
                                C =      12                                                    D = 13
                                E = 14                                                    F = 15
                                The hexadecimal numbers constant are written with 'OX' prefix.


                2] Float Constant :-
                                The constants which are in decimal or in exponential format are known as Float constant.
                                They are of two types.

                a) Real Float Const.
                                The constants which are in decimal format are known as real float constants.
                                                Ex. 3.14, 1.5
                b) Exponential Float Const.
                                This format of constants are used to represents the numbers which are so small or so large.
                                Ex. 1.2e8 which is equal to 120000000



                3] Character Constant :-
                                This type of constants are used to represent any kind of names.
                                2 types.

                a) Single Character constant
                                If we want to represent constant as a single character then this const. is used.
                                It is always written in single inverted commas.
                                                Ex.  'g', 'n'.
                b) String constant
                                If we want to represent constant as a word or any name then this const. is used.  It is always written in double inverted commas.

                                                Ex. "Nilesh", "Riya"


No comments:

Post a Comment

Popular Posts :