- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a multidimensional array? Explain with program
C language allows arrays of three (or) more dimensions. This is a multidimensional array. The exact limit is determined by compiler.
Syntax
The syntax is as follows −
datatype arrayname [size1] [size2] ----- [sizen];
For example, for three – dimensional array −
int a[3] [3] [3];
Number of elements = 3*3*3 = 27 elements
Example
Following is the C program for multidimensional array −
#include<stdio.h> main ( ){ int a[2][2] [2] = {1,2,3,4,5,6,7,8}; int i,j,k; printf ("elements of the array are :
"); for ( i=0; i<2; i++){ for (j=0;j<2; j++){ for (k=0;k<2; k++){ printf("%d", a[i] [j] [k]); } } } }
Output
When the above program is executed, it produces the following result −
Elements of the array are : 1 2 3 4 5 6 7 8
Advertisements
To Continue Learning Please Login
Login with Google