Variables:



A variable is a data name that may be used to store a data value. Unlike constants remain unchanged during the execution of a program; a variable may take different values at different times during execution.

Rules for constructing variable names:
a.      A variable name is any combination of 1 to 26 alphabets, digits or underscore. Some compilers allow variable names whose length could be up to 247 characters. Still, it would be safer to stick to the rule of 31 characters.
b.      The first character in the variable name must be an alphabet.
c.       No commas or blanks are allowed within a variable name.
d.      No special symbols other than underscore (as in roll_num) can be used in variable name.

Some valid variables are:-
roll_num, ram, names.

Some invalid variables are:-
prince$, roll num etc..

Previous                                                                                    Next

Powered by Blogger.