Multi dimensional Array in C Language

Multi dimensional Array in C Language

An array containing more than two dimensions is called multi-dimensional array. We can use more than two pairs of brackets to specify the size or refer any array element.

Syntax :

<Data_Type> Array_name[s1][s2][s3]……………….;

s1,s2,s3,…. specify the dimensions in the multidimensional array. They should be integer values.

Program of  multi dimensional array in C Language.

#include<stdio.h>
int main()
{
int a[2][2][2]={1,2,3,4,5,6,7,8};
printf("\n%d",a[0][0][0]);
printf("\n%d",a[0][0][1]);
printf("\n%d",a[0][1][0]);
printf("\n%d",a[0][1][1]);

printf("\n%d",a[1][0][0]);
printf("\n%d",a[1][0][1]);
printf("\n%d",a[1][1][0]);
printf("\n%d",a[1][1][1]);
return(0);
}

 

Spread the love
Lesson tags: Multi dimensional Array in C Language, multidimensional array in c, program of multi dimensional array in c
Back to: C Programming Language
Spread the love