A variable is a name of the memory location. It is used to store data. Its value can be changed, and it can be reused many times.
The example of declaring the variable is given below:
int a;
float b;
char c;
Rules for defining variables
- A variable can have alphabets, digits, and underscore.
- A variable name can start with the alphabet, and underscore only. It can't start with a digit.
- No whitespace is allowed within the variable name.
- A variable name must not be any reserved word or keyword, e.g. int, float, etc.
Invalid variable names:
int double;
float month name;
char 2number;
Comments
Post a Comment