variable

Variable

  • Variable is a name given to memory locations where different constants are stored.
  • Variable may vary during the execution of the program.
  • Example: Z=2.2*X+6-Y+32; here Z ,  X and Y are variables Which may vary during execution.
  • Variable name must start with an alphabet.
  • Variable name is combination of 1 to 8 alphabets, digits or underscores. Some compiler allow it up to 40 characters.
  • Variable name must not have any commas or blank spaces.
  • Variable name must not have any special symbol other the underscore.
  • e.g:  k_s, a, A s_3  etc . are valid variable.

Demonstration of variables

#include<stdio.h>
#include<conio.h>
void main()
{
int i=5;
printf(“value of i is= %d” i );
i=7;
printf(“value of I is =%d” i);
}