Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the correct way to declare an integer variable in C ?

  • A.integer x;
  • B.x int;
  • C.var x;
  • D.int x;

Answer: D

The correct declaration is int x;.

A C declaration gives the type first and then the variable name, ending with a semicolon. int is the keyword for the integer type, so int x; reserves storage for an integer called x.

C has no 'integer' keyword, putting the name before the type (x int;) is not C syntax, and var is used for declarations in JavaScript and C#, not in C.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.