So I am new to C coding and am struggling to understand what I am doing wrong. I keep getting the error mentioned in the title at the lines I have left comments on below.
typedef struct input{
double x;
double y;
double u;
double v;
double rho;
} input_t;
void read_file();
void read_file(){
int i = 0, count = 0;
char c;
FILE *fp;
fp = fopen ("flow_data.csv", "r");
if (fp == NULL){
printf("Error reading file, exiting...");
exit(EXIT_FAILURE);
}
while (!feof(fp)) {
fscanf(fp, "%f %f %f %f %f", &input_t[i]->x, &input_t[i]->y, &input_t[i]->u, &input_t[i]->v,
&input_t[i]->rho); //getting the issue here
i++;
}
for (i = 1; ; i++) {
printf("x: %f, y: %f, u: %f, v: %f, rho: %f \n", &input_t[i]->x, &input_t[i]->y,
&input_t[i]->u, &input_t[i]->v, &input_t[i]->rho); //getting the issue here
}
for (c = getc(fp); c != EOF; c = getc(fp)) {
if (c == '\n') {
count = count + 1;
}
}
printf("The file has %d lines\n ", count);
}
I've tried looking up solutions online but am struggling to see what I am doing wrong. Any tips or guidance would be great :) Thanks in advance!