Arrays in C (Array of Pointers and 3D Array) – Set 7

In this instructional exercise, I will inform you concerning two points for example cluster of pointers and 3D exhibits. So without burning through whenever lets head on to the primary point of this instructional exercise.

An exhibit of Pointers in C

As I disclosed to you before “Exhibit is a gathering of components of comparative information types”. We have just made a cluster of the whole number, skims, etc. So one inquiry that emerges.

Would we be able to make a cluster of pointers? Well, the appropriate response is indeed, obviously.

To cause an exhibit we to need to satisfy only one condition i.e it ought to contain components of the same information type. So we can store pointers of segregated factors inside an exhibit. Let’s take one guide to get this.

int main()
 int *a[4]; //declaration of array of pointers
 int x=23,y=54,z=65,p=45,q;
  printf("%d ",*a[q]);
 return 0;


23 54 65 45 


In the start of the program, I have proclaimed a 1D cluster of pointers with size 4. It implies it can store locations of four secluded pointer factors.

After that, I have pronounced some whole number factors and I have put away a few qualities in it.

Presently I have put away the addresses of whole number factors inside a cluster of pointers a.

In the last, I have printed every one of the qualities at the addresses put away in that exhibit by utilizing for circle.

Note: We can even store the addresses of different clusters inside the exhibit of pointers.

3D Array in C

As the name recommends these are exhibits having three measurements. By and large, a developer once in a while utilize 3D clusters.

They are for the most part utilized for some game programming. So I will just give you a review of that.

Presentation and Initialization of 3D Array

Lets take one guide to get it.

int a[2][2][2]={


{13, 56},

{54, 67}



{64, 87},

{23, 678}



In C language, 3D clusters treated as an accumulation of 2D exhibits. In the above model we can likewise say that we are making two 2D exhibits.

A case of the 3D exhibit is given underneath which is additionally a mix of three 2D clusters.

Memory Allocation of 3D Array

Allotment of memory of the 3D cluster is like a 2D exhibit. As the components inside the 3D cluster consistently put away in touching memory areas.

Leave a Comment

error: Alert: Content is protected!!