If I use:
Code:
double data[100][6];
And then in the body of the two for loops:
Code:
for(i = 0; i < nRow; i++) {
for(j = 0; j < nCol; j++) {
fscanf(fpIn, "%lf", &data[i][j]);
}
}
printf("file has been read in\n");
printf("the first entry is:\n");
printf("%lf\n", &data[0][0]);
All that gets returned is 0.00000. I'm starting to get really fed up with C and this assignment.
Apparently, I can do the same procedure with fgets and sscanf (our notes mention a spotty example of this). fgets pulls in each line essentially, but how would I read that to each row of 'data' using sscanf?
Code:
while(fgets(data, LINE_LENGTH, fpIn) != NULL)
{
sscanf(data, ????);
}