

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 :\n"); 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
- Related Questions & Answers
- What is a Multidimensional array in Java?
- What is a multidimensional array in C language?
- PHP Multidimensional Array.
- What is Image Array? Explain with an example in C++
- Multidimensional array in Java
- MongoDB multidimensional array projection?
- What is a RowSet object explain using a JDBC program?
- Initialization of a multidimensional array in C
- What is an anonymous array and explain with an example in Java?
- What is JavaScript closure? Explain with examples.
- How to set multidimensional array into JTable with Java?
- What is meant by Splicing an array in JavaScript? Explain with an example
- What is Queue in Python? Explain with examples
- What is context free grammar? Explain with examples
- What is 1NF in DBMS? Explain with examples
Advertisements