Using a Multidimensional Array - C++ Data Type

C++ examples for Data Type:Array

Description

Using a Multidimensional Array

Demo Code

#include <iostream>
#include <cstdlib>

using namespace std;

int myArray[10][20];

int main(int argc, char *argv[])
{
    int x,y;/*ww  w.  j  a  va  2 s  .  co m*/
    for (x = 0; x < 10; x++) {
        for (y = 0; y < 20; y++ ) {
            myArray[x][y] = x * y;
        }
    }
    cout << myArray[9][13] << endl;
    cout << sizeof(myArray) / sizeof(int) << endl;
    return 0;
}

Result


Related Tutorials