next up previous
Next: Automatic indenting Up: C++/C Previous: The hacking of printf

Dynamic multi-dimension array

To declar a multi-dimension array, the syntax is
int (*buf)[w] = new int[h][w];
For CC, w has to be a constant, but for g++ either the h or w can be variable and assigned at run-time.
\begin{quot}
It is an extension to the 1998 C++ standard,
which is called \lq\lq variable length arrays''
\end{quot}



Wei Lu 2007-11-06