A

Admin • 832.27K Points
Coach

Q. What is the type of variables “b” and “d” in the following code?

Code:
int a[], b;
int []c, d;
  • (A) ‘b’ and ‘d’ are of type int
  • (B) ‘b’ and ‘d’ are arrays of type int
  • (C) ‘b’ is a variable of type int; ‘d’ is an array of type int
  • (D) ‘d’ is a variable of type int; ‘b’ is an array of type int
  • Correct Answer - Option(C)
  • Views: 17
  • Filed under category Java
  • Hashtags:

Explanation by: Admin

If square brackets [] is declared after the variable, it only applies to a single variable. If square brackets [] is declared before the variable, it applies to all variables.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.