What is Variables ? Write a short note on Variables. Discuss about Variables.
Variables :-
A variable is an identifier
that denotes a storage location used to store a data value. Unlike constants that remain unchanged during the
execution of a program, a variable may take different values at different times during the execution
of the program. In Chapter 3, we had used
several variables. For instance, we used variables length and breadth to
store the values of length and breadth
of a room.
A variable name can be chosen by the
programmer in a meaningful way so as to reflect what it represents in the
program. Some examples of variable names are:
• average
• height
• total height
• classStrength
As mentioned earlier, variable names may
consist of alphabets, digits, the underscore ( _ ) and dollar characters, subject to the following conditions:
1. They must not begin with a digit.
2. Uppercase and lowercase are distinct. This means that the variable Total is not the same as total
or TOTAL.
3. It should not be a keyword.
4. White space is not allowed.
5. Variable names can be of any length.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment