-
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 };
Correct Option: AExplanation: <p>Answer: Option A </p>
<p> Let us see how to initialize an array while declaring it. Following are a few examples that demonstrate this. </p>
<pre>
int roll[6] = { 2, 4, 12, 5, 45, 5 } ;
int array[ ] = { 2, 4, 12, 5, 45, 5 } ;
float points[ ] = { 12.3, 34.2 -23.4, -11.3 } ;
</pre>
<p><a title="Single Dimensional Array in C Programming Language" href="../tutorial/array-in-c-language/1/201">Learn more details about Single Dimensional Array in C Programming Language</a></p>
<p><strong>Note the following points carefully:</strong></p>
<p>(a) Till the array elements are not given any specific values, they are supposed to contain garbage values.<br />(b) If the array is initialized where it is declared, mentioning the dimension of the array is optional as in the 2nd example above</p>