K

Kanak Sharma • 5.38K Points
Tutor III

Q. What is the correct syntax to declare a variable in C?

  • (A) data_type variable_name;
  • (B) data_type as variable_name;
  • (C) variable_name data_type;
  • (D) variable_name as data_type;

Explanation by: Kanak Sharma
In C language, the correct syntax to declare a variable is:

data_type variable_name;

Where, data_type is the type of data (such as int, char, float, etc) and variable_name is a valid identifier. For example: int age;

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics