google Ads

Friday, July 17, 2009

Double Dimensional Array in JAVA

Double Dimensional Array


Double dimensional arrays are defined in the same manner as one dimensional arrays, except that a separate pair of square brackets are required for each subscript.

Example:
int n[6][6];

The above declaration defined the coordinate as a integer of 6 rows and 6 columns

Initializing an array

Consider the following two dimensional array declaration,
int n[4][2] = { { 2,6 } { 8,4 } { 7,5} {10,15} }

Where

n[0][1] = 6
n[3][0] = 10
n[2][1] = 5
n[1][0] = 8

No comments:

Post a Comment