January 14, 2011
C++ create 2D array

How to create dynamic 2d array in C++ ? This is a code to create 2D array in C++ : float **ArrayLib::create2Array_float(int row, int col) { int i; float **out; out = new float*[row]; out[0] = new float[row*col]; for(i=1; i<row; i++) { out[i] = out[i-1] + col; } return out; } If you want to