T

Team MCQ Buddy • 20.45K Points
Instructor III

Q. Which is/are the correct syntax to initialize an array in C?

  • (A) data_type array_name[array_size] = {value1, value2, value3, …};
  • (B) data_type array_name[] = {value1, value2, value3, …};
  • (C) data_type array_name[array_size] = {};
  • (D) Both A and B

Explanation by: Team MCQ Buddy
Both the options A and B are correct to initialize an array.

Example:

int mark[5] = {19, 10, 8, 17, 9};
// or
int mark[] = {19, 10, 8, 17, 9};

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics