H
Hai Ly Hoang
Hi,
With these code:
int a[3][5];
we are allocated (static) an array 3-by-5 (but continous) elements.
But how to allocated dynamically an 3x5 array ?
The way i know is:
a = new int *[3];
a[0] = new int[5];
a[1] = new int[5];
a[2] = new int[5];
Too complex for a simple task ! and the allocated space is not continous !
Anyone know the way to allocated dynamic an array with continous space in
C++ ? (in pascal, it's quite easy to do such thing ).
Thanks in advance !
With these code:
int a[3][5];
we are allocated (static) an array 3-by-5 (but continous) elements.
But how to allocated dynamically an 3x5 array ?
The way i know is:
a = new int *[3];
a[0] = new int[5];
a[1] = new int[5];
a[2] = new int[5];
Too complex for a simple task ! and the allocated space is not continous !
Anyone know the way to allocated dynamic an array with continous space in
C++ ? (in pascal, it's quite easy to do such thing ).
Thanks in advance !