Variable is the name given to memory. Using this variable we can write program very easily.
There are some conventions for giving variable names.
i) When initializing variable first letter should be small alphabet letters[a-z]-or capital letters[A-Z].
ii) No special character other than underscore should be given in variable name.
iii) Variable name is case sensitive.
Eg:
You are giving the variable salary in the program. All letters in the word salary are small letters.
When you use this variable elsewhere you should not give it Salary because here S is CAPITAL letter.
The variable named salary given by you above and the variable named salary given earlier are also different.
So the same way you give a variable, it should be used everywhere. This is what we call case sensitive.
iv) A variable name can be composed of letters and numbers, but the first letter should not always be a number.
Eg:
age1, age2
v) C program keyword should never be used as variable name.
Eg:
int,goto,while.
Constant in C
A variable is called constant if its value does not change.
We can declare any data type as constant by using const keyword.
Syntax:
const data_type variable_name = value;
EX:
const int i=10;
const char x=’g’;
Using this const keyword, the value given to the variable cannot be changed in the program.
This is the difference between variable and constant.