title: Simple 3D Array C++
body: <p>I am a novice in C++ and I am trying to create a simple static 3 Dimensional Array and then print it out in console.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
    const int MAX_ROW = 2;
    const int MAX_COL = 2;
    const int MAX_HEIGHT = 2;
  
    int MyArray[MAX_ROW][MAX_COL][MAX_HEIGHT] = { {1,1},
                             {2,10},
                             {3,15},
                             {4,20},
                             {5,25},
                             {6,30},
                             {7,35},
                             {8,40} };
  
    for(int Row = 0; Row &lt; MAX_ROW; ++Row)
    {
     for(int Col =0; Col &lt; MAX_COL; ++Col)
     {
      for(int Height = 0; Height &lt; MAX_HEIGHT; ++Height)
       {
        cout &lt;&lt; "Integer["&lt;&lt; Row &lt;&lt; "][" &lt;&lt; Col &lt;&lt; "][" &lt;&lt; Height &lt;&lt; "] = " &lt;&lt; MyArray[MAX_ROW][MAX_COL][MAX_HEIGHT] &lt;&lt; endl;
       }
      }
     }
  
  
  
    return 0;
  }
  </code></pre>
  
  <p>When I compile the compiler notifies me stating <code>"error: too many initializers for ‘int [2][2][2]"</code></p>
  
  <p><strong>Other questions have used pointers which I am not familiar with.</strong></p>
  
  <p>Thank you in advance!</p>
  
  <p><strong>Edit:</strong> The syntax is wrong so I have corrected it with the correct corresponding code as answered below. Now in the output of the program each array space is 32767. A full integer space instead of the assigned values. Can anybody address this in their answer? I have not changed any code except my initialisation of the array.</p>