Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Multidimensional Arrays

$
0
0
Hello, I have recently been trying to make a new program making multidimensional arrays! Here is my code:
 #include <iostream>

using namespace std;

int main()
{

    const int MAX_ROWS = 3;
    const int MAX_COLUMNS = 3;
    
    char table [MAX_ROWS][MAX_COLUMNS] = {
        {  {'O', 'X', 'O'},
            {'O', 'X', 'X'},
            {'X', 'O', 'X'} }
    };
    
    for (int i = 0;i<MAX_ROWS;i++){
        for (int j = 0; j<MAX_COLUMNS;j++) {
            cout << table[i][j];
        }
        cout << endl;
    }
    
    return 0;
}



I get the error: Excess elements in scalar initializer on line 12 on the X.
Could anybody help?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>