Computer Science, asked by mansoorkhan40233, 7 months ago

Write syntax for 2D Array in C language program.​

Answers

Answered by Oreki
0

Syntax

<Data Type> <Array Name> [d1] [d2] [d3] [d4] ... [dn];

Where each d is a dimension, and dn is the size of final dimension.

Examples

Declaration

int array [2] [4];

Declaration with Initialization

int array [2] [4] = {

{10, 11, 12, 13},

{14, 15, 16, 17}

};

OR

int array [2] [4] = { 10, 11, 12, 13, 14, 15, 16, 17};

Even though both the above declarations are valid, I would recommend you to use the first method as it is more readable and we can visualize the rows and columns of 2D array in this way.

Similar questions