1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

for loops with double pointers

Discussion in 'C' started by reverbtank, Jun 19, 2008.

  1. reverbtank

    reverbtank New Member

    Jun 19, 2008
    Likes Received:
    Trophy Points:
    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 = new double[h];
    for (j = 0; j < h; j++)
    new_img [j] = img [j];
    ...of course the code goes on...

Share This Page