Multi-dimensional array and pointers in C++?

后端 未结 6 1516
悲哀的现实
悲哀的现实 2020-12-20 09:35
int *x = new int[5]();

With the above mentality, how should the code be written for a 2-dimensional array - int[][]?

i         


        
6条回答
  •  抹茶落季
    2020-12-20 10:13

    Ff the array has predefined size you can write simply:

    int x[5][5];
    

    It compiles

    If not why not to use a vector?

提交回复
热议问题