John Bode said:
These are bindings called from fortran. I want to assign a value to an
array:
int *maxstrikes, double *ltginfo[8][*maxstrikes]
There's no ; there. I think these are actually function parameters,
rather than object definitions. If so, it might be important so I'd
include that context.
MYSQL_ROW row;
ltginfo[2][strike] = atof(row[2]);
but Im getting the error:
error: incompatible types in assignment
what am I doing wrong?!
ltginfo is declared as a 2-d array of *pointer* to double; therefore,
ltginfo[2][strike] is a pointer to double, not a double, so you need
to do
*(ltginfo[2][strike]) = atof(row[2]);
assuming ltginfo[2][strike] points somewhere meaningful.
It's probably worth pointing out that it is possible that the
assignment is correct and the definition of ltginfo is wrong;
i.e. that what is needed is:
int *maxstrikes, double ltginfo[8][*maxstrikes]
MYSQL_ROW row;
ltginfo[2][strike] = atof(row[2]);
Whilst integer arguments (in Fortran) are likely to turn into pointers
to int in C, it is not likely that a 2D array of doubles will be
mapped to a 2D array of pointers to double.
Another possibility is that an extra pointer level /is/ required, but
to the whole array:
int *maxstrikes, double (*ltginfo)[8][*maxstrikes]
MYSQL_ROW row;
(*ltginfo)[2][strike] = atof(row[2]);
though that seems unlikely.
To the OP: how sure are you that the type of ltginfo is correct?