Hey, im trying to write a program that computes the determinant of a 3x3 matrix from another file. Ive only tried to input the file so far and i keep getting the error 'passing argument 1 of 'fscanf' from incompatible pointer type' but cant work out whats wrong.
Code:#include <stdio.h> #include <stdlib.h> #include <math.h> #define orderOfMatrix 3 int main(int argc, char* argv[]) { FILE *input; const char inp_fn[]="matrix.dat"; int i, j, m[3][3], det; /*Open file */ input = fopen(inp_fn, "r"); /* Check the pointers to files are not NULL */ if( (input != (FILE*) NULL)) { for(i=0; i<orderOfMatrix; i++) { for(j=0; j<orderOfMatrix; j++) { fscanf(inp_fn, "%lf \n", &m[i][j]); } } return 0; } else { printf("*** Could not open input file! ***\n"); } /*close file */ fclose(input); return(EXIT_SUCCESS); }



LinkBack URL
About LinkBacks


