Examveda

What is right way to Initialize array?

A. int num[6] = { 2, 4, 12, 5, 45, 5 };

B. int n{} = { 2, 4, 12, 5, 45, 5 };

C. int n{6} = { 2, 4, 12 };

D. int n(6) = { 2, 4, 12, 5, 45, 5 };

Answer: Option A

Solution (By Examveda Team)

option (B), (C) and (D) are incorrect because array declaration syntax is wrong. Only square brackets([]) must be used for declaring an array.


This Question Belongs to C Program >> Arrays And Strings

Join The Discussion

Comments (1)

  1. Pramod Tonape
    Pramod Tonape:
    9 years ago

    how its come

Related Questions on Arrays and Strings