# Lesson 1c Multidimensional Arrays

Topics: Array, The Elements, Element Pages: 4 (396 words) Published: January 10, 2015
﻿Lesson 1b
MULTIDIMENSIONAL ARRAYS
Multidimensional arrays concept is much the same as one-dimensional arrays, except that the array values in a multidimensional array will store the data as table of values in rows and columns.

Declaring 2-dim array:
int twoArr;
twoArr is an array of integer with 3 rows and 4 columns
twoArr has 12 elements (4 elements per row).

and 0 for the column
the second subscript (column) increase most rapidly
Accessing 2-dim array elements:
twoArr = 1twoArr = 2twoArr = 3twoArr = 4 twoArr = 5twoArr = 6twoArr = 7twoArr = 8 twoArr = 9twoArr = 10twoArr = 11twoArr = 12

Initializing 2-dim array values:
int twoArr = {1,2,3,4,5,6,7,8,9,10,11,12};
int twoArr = {{1,2,3,4},{5,6,7,8},{9,10,11,12}};

int twoArr = {1,2,3,4,5,6,7,8,9};

int twoArr = {{1,2,3},{4,5,6},{7,8,9}};

Sample Programs:
Inputting and Outputting 2-dim array values
#include
#include

main()
{
int number;
int x, y;
printf("Enter 9 integer values: ");
for(x=0; x the array for(x=0; x