dynamically allocating multi-dimensional array using new
Posted on 1998-12-13
Here is the beginner's question: How do I dynamically allocate a multi-dimensional array say int test[row][col] using the C++ 'new' operator? I tried the following:
test = new (int*)[row];
test[i] = new int[col];
but it didn't even compile...
I also tried test = new int[row][col], no lucky either...
Can anybody please help? Also, it will be good if you can show me how to free the array using 'delete'. Thanks a lot and sorry for the point :-Ppp (that's all I have)