Simple 3D Array C++

后端 未结 5 1587
深忆病人
深忆病人 2021-02-05 13:57

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.

Here is my current code:

#include &l         


        
5条回答
  •  伪装坚强ぢ
    2021-02-05 14:25

    Apart from wrong array initialization as others have pointed out you also have an error in printing. You always print the same element that doesn't even exist (which is undefined behaviour).

    cout << "Integer["<< Row << "][" << Col << "][" << Height << "] = " << MyArray[Row][Col][Height] << endl;
    

提交回复
热议问题