πŸ“Š C Programming
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) Both A and B

Explanation: 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};

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};

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
311
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Team MCQ Buddy
Publisher
πŸ“ˆ
89%
Success Rate