A symbolic name which is used to store data item (numerical quantity or a character constant) is known as variables.It is nothing but a name given to a storage area that our programs can manipulate.It is the name of memory location.It is a way to represent memory location through symbol so that it can be easily identified.
Variable Declarations:
- Data_type variable;
- Data_type variable_1, variable_2, …….., variable_n;
Rules for variable declaration
- Starts with letters and underscore only. Not by digits.
- Keywords can’t be a variable.
- White spaces are not allowed between characters of variable, but underscores are allowed.
- The variable name is case sensitive. (i.e. uppercase and lowercase are different.)
Examples of valid variable names:
- Int a;
- char abc;
- float abc234;
- char _var;
- char SG_Tech;
- char Var; and char var are different.
Examples of invalid variable names:
- Int 12;
- float 1abc;
- char 1a2b3c4d;
- char SG Tech;