C Variables

  • A variable is a name of the memory location which can change the value of time of execution.
  • Before using any variable in the program, it must be declared it.
  • Declaration of variable means need to mention data type. Name of the variable followed by semicolon(;).
  • In variable declaration must be exist top of the program before defining the first statement.
  • In variable declarations, name of the variable must be starts with alphabet or underscore only.
  • In variable declarations, maximum length of the variable is 32 characters after 32 characters, compiler will be not consider remaining characters.
  • In variable declarations, existing keywords,operators,separators and values are not allowed.
  • In declaration of variable, single space required between data type and name of the variable.
  • In implementation, when we are declaring multiple variables of same data type then go for (,) as a separator for every variable.

Syntax:

Data Type variable_name;
Data Type variable_name1, var2, var3;

Examples:

int a;
int xy,y,z;
int a=1;
char student_name;
int _total_sal;

Powered by k2schools