Multidimensional Array C Example - C

What is multidimensional array in C language?

Snippet Code


  
Rate this page :
  [ 0 votes]

Multidimensional array is used to create array of arrays. It is also known as matrix. The simplest form of multidimensional array is two dimensional array. The code given below is an example for an array with 3 rows and 2 columns.

#include <stdio.h> int main () { int arr[3][2] = { {1,2}, {3,2}, {5,4}}; int i, j; for ( i = 0; i < 3; i++ ) { for ( j = 0; j < 2; j++ ) { printf("arr[%d][%d] = %d\n", i,j, arr[i][j] ); } } return 0; }

Tags


Ask Questions

Ask Question