We must take special care while naming the variable else it will lead to mystification.
Let us consider the following two code snippets
int main()
{
int i=3,j=5,k=0;
k = i*j;
printf(“area of rectangle = %d”,k);
return 0;
}
Code 2:
int main()
{
int base=3,height=5, rect_area=0;
rect_area = base*height;
printf(“area of rectangle = %d”,rect_area);
return 0;
}
The above two programs used to find the area of rectangle. However which one of it gives more meaning?
Do the variables (i,j,k) in Code 1 give any sort of meaning? They lead to confusion, don’t they?
Where as the variables (base, height, rect_area) in Code 2 give us more meaning than the Code 1.
So always try to give meaningful names to the variable.