What Is An Array? Explain 2D Array With Memory Representation.

1 year ago
C Programming

Array: array is a collection of similar data types stored in a contiguous memory location. Array helps to declare many variables at one time. The array always started with zero. And the last length of the array is n-1. The given n means the total of the array. And the address of the array is always contiguous memory. The address of the array depends upon the data types of the array.

Two-Dimensional Array [2D Array] 

The 2 Dimensional Array is used form of the matrix (row and Colum).

Syntax of the 2D array: – This is the syntax of the 2-dimensional array.

<DataTypes>ArrayName[Row_size][Coloum_size];

Declaration & Initialization Of 2D Array:- 

The declaration means how to declare the 2d array. And initialization means how to assign the value of its. The total length of the Size = Row_size X Coloum_size.

Ex –

int arr[2][5] = { { 2,6,7,8,9,},{3,10,25,23,8}};

                                 

 

0
Rusma Khadka
Dec 27, 2022
More related questions

Questions Bank

View all Questions