Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   for loops with double pointers (http://www.go4expert.com/forums/loops-double-pointers-t11482/)

reverbtank 19Jun2008 22:02

for loops with double pointers
Hi, I'm debugging a program that frequently will read a fits file image and store it in an array, the most frequent way that the original programmer did this was by using nested for loops to first handle the rows and then the columns of the array. I'm still new to programing and get very confused by pointers especially when they are to arrays. Could someone give me a precise, explanation to the following sample for loop with close attention to the pointers and double pointers in terms of the function, function arguments and declared variables?
double **remove_bright(double **img, int w, int h)
double **new_img;
int i, j, ii, jj;

//copy image for processing
new_img = new double*[w];
for (i = 0; i<w; i++)
new_img[i] = new double[h];
for (j = 0; j < h; j++)
new_img[i] [j] = img[i] [j];
...of course the code goes on...

All times are GMT +5.5. The time now is 20:31.