Variables is a data name
that may be used to store data value .
A variable is a quality which may change during program execution .
A variable may be different value at different time during execution of the program.
Ø for example: int sum;
Here sum is the name of the variable and this variable can store only integer quantity.
Ø Rules for constructing variable name -
1. A variable name is any valid combination of alphabets, digits and underscore.
2. The variable name must begin with alphabet or underscore.
3. Commas and blanks are not allowed to construct the variable.
4. Variable name should not be a keyword.
5. Only underscore special symbol can be used to construct a variable .
Ø some example of VALID variable name –
num, x , distance, Ajay, num_123
Ø some example of INVALID variable name-
(SUM),char,12th,price$
Comments
Post a Comment