Variables in C Interview questions

Total available count: 1
Subject - Programming Languages
Subsubject - Variables in C

Write syntax for declaring a variable?

data-type var1, var2, ……….. , varn;
where a data-type is an already-defined data type, while var1, var2, …. , varn are the names of variables. Note that, the variable names must be separated by commas, and the declaration statement must end with a semicolon. 

Example of Variable declaration:

  1. int no;
  2. int sum, avg;
  3. float interest, amount;
  4. char x,y,z;
  5. float x, y; 
  6. double a;

It is also possible to add modifiers with the basic data types during declaration of variables.

  1. short int no;
  2. unsigned int sum, avg;
  3. long int interest, amount;