Introduction:
In C , you cannot define such an array int [] arr = new int [] as in Java, if we want to implement the dynamic array in C , based on the program's run.
Dynamic one-dimensional array:
#include using namespace std; int main () {int LEN; cin >> Len; int * p = new int [len]; delete [] p; p = null; return 0;} Dynamic 2D array:
Int main () {int Row, col; cout << "please enter the number for row and color:" << Endl; cin >> row >> col; // is a two-dimensional array open space int ** P = New INT * [ROW]; for (int i = 0; i
Of course, you can use a pointer to implement a multi-dimensional array, but this should be easier to use by Vectors in STL. Author: Simahao Time: 05.1.11