Header Ads Widget

Ticker

6/recent/ticker-posts

2D Array ( two dimensional array) in c

 what is two dimensional array?

a two dimensional array is an array of array where it can be consider that a two D array is nothing but a 1-D array where each element is itself an array.

A two-D array can be visualized as an arrangement of element in row column format as shown below in the diagram :

               


  A two dimensional array can be declared ,initialize and access in following ways:

(1). Declaration of 2-D array:-

      The syntax of declaration of a 2-D array is given below-

        data type   array-name[row size][column size]

where data type  specifies  data type of element to be stored in the 2-D array ,
           array-name is user define name given to the 2-D array,
          row size specifies the number of rows,
          column size species the number of columns.

for example :- consider a 2-D array having 2 rows and 3 column and store integer value then it can be declared as :
           
                       
 (2). Initialization of  2-D array :-
                                         
                                    A 2-D array can be initialized in any of the following three ways :-  
    1) Individually each elements:-

    

    2) Initialization with the declaration



    3) Using loops:-
                                  for initializing a two array by using loops we need to use two loops first for the row and second for the column .

Video lecture:-




Recommended Post:

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-


 
       

Post a Comment

0 Comments