Hello!
I am wondering how to create a dynamic array in C ++
According to all the descriptions I've found, we create a two-dimensional array like this:
what prevents declaring such a table like this:
Both versions work theoretically the same, while the second version is incomparably simpler and more natural.
I am wondering how to create a dynamic array in C ++
According to all the descriptions I've found, we create a two-dimensional array like this:
int w=10, k=10;
int **tab = new int *[w];
for ( int i = 0; i < w; ++i )
tab[i] = new int [k];
what prevents declaring such a table like this:
int w=10, k=10;
int tab[w][k];
Both versions work theoretically the same, while the second version is incomparably simpler and more natural.