To dynamically assign a two-dimensional array, you must write a repeat statement as follows:
int sizeX = 5;
int sizeY = 10;
int** ary = new int*[sizeX];
for(int i = 0; i < sizeY; ++i)
ary[i] = new int[sizeY];
If you look at the picture, it's easy to understand.
© 2024 OneMinuteCode. All rights reserved.