#include <stdio.h>
int main()
{
int a[][] = {{1,2},{3,4}};
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
printf ( "%d " , a[i][j]);
return 0;
}
|
(A) 1 2 3 4
(B) Compiler Error in line ” int a[][] = {{1,2},{3,4}};”
(C) 4 garbage values
(D) 4 3 2 1
Answer: (B)
Explanation: There is compilation error in the declaration ” int a[][] = {{1,2},{3,4}};”.
Except the first dimension, every other dimension must be specified.
int arr[] = {5, 6, 7, 8} //valid
int arr[][5] = {}; //valid
int arr[][] = {}; //invalid
int arr[][10][5] = {}; //valid
int arr[][][5] = {}; //invalid
Quiz of this Question
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...