How to dynamically create an array

zhaozj2021-02-17  50

You can use pointers to implement, do this:

If it is one-dimensional, int * arr; / / can be other types (char, float ...) arr = new int [n]; // n must be an integer variable

Two-dimensional, so,

INT ** Arr; INT N, M; CIN >> N >> m; Arr = new int * [n]; for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-29125.html

New Post(0)