array1[array2[1]] question

Pages: 12
If the code in the program is in fact how you pasted it, and it is behaving how you describe, then the only thing I can think of is that you are using an extremely old and buggy compiler.

That code wouldn't even compile as posted in a modern compiler.
Okay, that might explain it then. The 2006 compile was on the then frequent used compiler, so I doubt it, but heck......
Where exactly does "k" come from? I see no declaration.
From a for next loop that goes through the curves in the model array.
1
2
3
        for(k=0; k<ncurves; k++)
        {
        }
OK, but where is the declaration? I don't see "int k;" anywhere.
Here is the whole first lines of fitmodel:

1
2
3
4
5
6
7
8
9
10
int fitmodel(int nr, int nc, matrix_type field, int ncurves, curve_type *model,
			pixel_coord rfp1, pixel_coord rfp2)
{
  int np, k, i, j;
  int p0[9] = {-1,  0,  0,  0, 0,  0, 1, 2, 1};
  int p1[9] = {-1, -1, -1, -1, 3, -1, 2, 3, 0};
  double cx0[3], cy0[3], cx1[3], cy1[3];
  double t0, t1, cutx[3], cuty[3], tmpcx[3], tmpcy[3], tmpt, *xp, *yp;
  double xs[NP], ys[NP], xw[NP], yw[NP], xsw[NP], ysw[NP];
  double f1, f2, omega, dt0, dt1, tw0, tw1, oldt;
closed account (1vRz3TCk)
Here is a tip for you: If you want to ask how a function is doing what it is doing, don't cherry pick little bits of it and post them. If we can't see what else is going on we can't tell you. For all we know the model pointer inside fitmodel maybe reassign to point to the 3rd element so when it is accessed with a -1 index you get the second element.
Topic archived. No new replies allowed.
Pages: 12