If we don't know the size of the array before running, usually we use the dynamic allocation.
My question is when I already define and allocate memory for a pointer to two-dimensional array, may I directly use the array expression A[j] to this pointer as I showed as following?
Borland C++6.0 doesnot accept this expression with error messsage of" invalid indirect". But BCB2006 seems works.
fftw_complex *in1,*out1;
in1 = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*mFFTSize);
out1 = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*mFFTSize);
for( int j = 0; j < fNumSample; j++ ) {
in1[j][0] = fTestdata[channel][j]; //one channel one trial data
in1[j][1] = 0;
}
So, what I really want to know is what is the best way to define and use multiple-dimension arrays in this situation? And as a function argument, which is the best efficient way to define and pass multiple-dimension array?