Variable
The named memory locations which store data and its computational results are called variables. The value of variable can be changed during the execution of the program.
Example: int a=5;
Variable declaration
Variable declaration specifies the variable name and data type but doesn’t set aside any memory for the variable.
Example : int a;
Variable definition
Variable definition specifies the variable name and type of the variable and also set aside a memory for the variable.
Example : int a;
Variable definition
If any variable assigned with some value at definition time then it is called variable initialization.
Example : int a = 5;
Rules of naming variable
● Alphabets, numbers and underscores are allowed.
● First character must be alphabet.
● Only lower case is recommended.
● 31 characters are allowed to use.
● Reserved words are not allowed to use as variable name.
● Special symbols are not allowed to use.
● One variable is to be declared by any one data type.
● Blank spaces are not allowed.
The named memory locations which store data and its computational results are called variables. The value of variable can be changed during the execution of the program.
Example: int a=5;
Variable declaration
Variable declaration specifies the variable name and data type but doesn’t set aside any memory for the variable.
Example : int a;
Variable definition
Variable definition specifies the variable name and type of the variable and also set aside a memory for the variable.
Example : int a;
Variable definition
If any variable assigned with some value at definition time then it is called variable initialization.
Example : int a = 5;
Rules of naming variable
● Alphabets, numbers and underscores are allowed.
● First character must be alphabet.
● Only lower case is recommended.
● 31 characters are allowed to use.
● Reserved words are not allowed to use as variable name.
● Special symbols are not allowed to use.
● One variable is to be declared by any one data type.
● Blank spaces are not allowed.
No comments:
Post a Comment