Having troubles reading in file to array
Code:
#include<stdio.h>
#include<math.h>
#define NROWS 8
#define NCOLS 7
int main (void)
{
FILE *input;
int i;
int j;
double power[NROWS][NCOLS];
input=fopen("power1.dat", "r");
if(input==NULL)
printf("Error opening input file. \n");
else
{
for(i=0; i<NCOLS; i++)
for(j=0; j<NCOLS; j++)
printf("i is %d, j is %d with value %lf", i, j, power[i][j]);
}
return 0;
}
My i and js work fine but i dont get the right value for power[i][j], can anybody see anything wrong with it