Okey, i'v made some progress. I have changed the code to;
Code:
int main()
{
int i,j;
int sizeXY=100;
int sizeZ=50;
float ***Image;
Image = new float **[sizeXY];
for(i=0;i<=sizeXY-1;i++)
{
Image[i] = new float *[sizeXY];
for(j=0;j<=sizeXY-1;j++)
{
Image[i][j] = new float[sizeZ];
}
}
delete Image;
}
But then I want to check for memory leaks;
Code:
sohail@thabox:~/docs/tustuff/BEP/cpp/threeD$ free
malloc: using debugging hooks
total used free shared buffers cached
Mem: 385464 299264 86200 0 23708 173696
-/+ buffers/cache: 101860 283604
Swap: 497972 0 497972
sohail@thabox:~/docs/tustuff/BEP/cpp/threeD$ make test
malloc: using debugging hooks
c++ main.cpp -o prog.exe -lgsl -lgslcblas -lm -O2
malloc: using debugging hooks
malloc: using debugging hooks
malloc: using debugging hooks
malloc: using debugging hooks
malloc: using debugging hooks
sohail@thabox:~/docs/tustuff/BEP/cpp/threeD$ ./prog.exe
malloc: using debugging hooks
sohail@thabox:~/docs/tustuff/BEP/cpp/threeD$ free
malloc: using debugging hooks
total used free shared buffers cached
Mem: 385464 299480 85984 0 23880 173660
-/+ buffers/cache: 101940 283524
Swap: 497972 0 497972
sohail@thabox:~/docs/tustuff/BEP/cpp/threeD$
as you can see, I have a memory leak (llok at the free memory before and after running the program.)
But the program runs without error :-)