Hi friends these array series presentation gives you clear cut knowledge in array in c++ programming, array in c++ tutorial, array in c++ syntax, array in c++ example
3. Multidimensional arrays
• Arrays can, however, get
multidimensional too.
• We can create an array of any number of
dimensions, and that is what makes
multidimensional arrays an interesting
topic from mathematical points of view.
4. Declaring multidimensional array
• Each dimension in an array is represented as a
subscript in the array. Hence for
– Two-dimensional array has two subscripts
– three-dimensional array has three subscripts
– & so on
int twoDi_array[2][2];
5. Continue …..
• Keep in mind
– first subscript = rows
– Second subscript = columns
int twoDi_array[2][2];
8. Initializing Multidimensional Arrays
• Initialization can be done as for uni
dimensional array
– Int Array[5][3] = {
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
9. Continue …..
• For sake of clarity and readability we can write
like this way also
1 2 3
– int Array[5][3] = { {1,2,3},
4 5 6
{4,5,6},
7 8 9
{7,8,9}, 10 11 12
{10,11,12}, 13 14 15
{13,14,15} };
10. • The compiler ignores the inner braces, but they
do make it easier to understand how the
numbers are distributed.
• When initializing elements of an array, each value
must be separated by a comma, with-out regard
to the braces.
• The entire initialization set must be within braces
& it must end with a semicolon.