Variable declarations : -

Name of the memory location is called variable

Generally when we required to change the data of the time of execution then we need to go for variable,

  • Before using any variable in the program, it must be declared first
  • Declaration of variable means require to specify data type, name of the variable followed by semicolon(;)
  • In ‘c’ programming language, variable declaration must be exist top of the program after opening the curly brace before writing first statement.
  • In variable declarations, name of the variable must be starts with alphabet or ‘_’(underscore) only.
  • Maximum length of the variable name is “32” characters, After 32 characters, compilers doesn’t consider remaining characters.
  • In variable declarations, existing keywords, operators separators and constant values are not allowed.
  • In variable declarations, at least single space should be required b/w data type & name of the variable.
  • When we are declaring multiple variable of same datatype, we use “’” as separator.



Datatype variable;

Datatype var1,var2,var3;

  1. Inta; error
  2. Int a_ Error
  3. Int a;
  4. Int a b c; Error
  5. Int a,b,c;
  6. Int 1a,1b,c1; Error
  7. Int a1,b1,c1;
  8. Int abc,d;
  9. Int if; error10.
  10. Int If; yes
  11. Int If; yes case sensitive
  12. Int if., yes
  13. Int if; yes
  14. Int total-sal; error
  15. Int 1,2,3; error
  16. Int -1,-2,-3,yes
  17. Int -.,yes


Void main()


Int I;

Float f;



Printf(“%d  %f”,I,f);



o/p:  2   2.000000


ValueInt Float




Operator behaviour is always variable independent i.e Acc to the variable type, the behaviour of the operator will not be changed.

  • Always the operator behaviour is operand dependant only
  • e depends on the i/p data, the behaviour of the operator will change
  • Always return value behaviour is variable dependant only. i.e depends on the variable type automatically return value will converted.
  • In implementation, when operator is returning an integer value, we require to assign the data to float variable, then automatically data will be converted into float format by adding “.0”
  • Whenever the operator i.e returning float value and we require to assign an integer variable then decimal point only require to assign.


By default, whenever we are declaring any variable, it bolds garbage value initially