3 Dimensional Arrays in C || Lesson 49.2 || C Programming || Learning Monkey ||

Опубликовано: 09 Сентябрь 2024
на канале: Learning Monkey
10k
204

3 Dimensional Arrays in C

We will try to understand 3 Dimensional Arrays in C in this class.

Our previous classes clearly explained the concepts of one-dimensional and two-dimensional arrays.


3 Dimensional Arrays in C

The below shows the way the 3-dimensional arrays are declared in C.

Visualizing a 3 Dimensional array

For example, if we consider our first declaration, it states that it has three columns of two-dimensional arrays, and each two-dimensional array has three rows and three columns.

The number of elements in the above array is 3*3*3 = 27.

For example, assume that our first array has elements from 1 to 27.

The visualization of the 3-dimensional array is shown below.

Accessing the elements of the 3-dimensional arrays

All the elements are stored linearly on memory.

If we want to access six, then the declaration should be a[0] [1] [2].

The above declaration means that in the zero blocks of the 2-dimensional arrays, access the element in the first row and second column.





Link for playlists:



Link for our website:

Follow us on Facebook @

Follow us on Instagram @

Follow us on Twitter @

Mail us @ learningmonkey01