C LANGUAGE
Variables
Variables are memory location in computer's memory to store data. To indicate the memory location, each variable should be given a unique name called identifier. Variable names are just the symbolic representation of a memory location.
Examples of variable name:
sum, car_no, count etc.
int num;
Here, num is a variable of integer type.
Rules for writing variable name in C
-
Variable name can be composed of letters (both uppercase and lowercase letters), digits and underscore '_' only.
-
The first letter of a variable should be either a letter or an underscore. But, it is discouraged to start variable name with an underscore though it is legal. It is because, variable name that starts with underscore can conflict with system names and compiler may complain.
-
There is no rule for the length of length of a variable. However, the first 31 characters of a variable are discriminated by the compiler. So, the first 31 letters of two variables in a program should be different.In C programming, you have to declare variable before using it in the program.
