Invalid argument of type '->' C
I keep getting the error
invalid type argument of '->' (have 'int')
on the line marked with arrows when trying to read the contents of an input file from a separate function.
It works if it is stored in the main program. I realize this probably has something to do with pointers, but I can't seem to fix it.
#include <stdio.h>
#include <stdlib.h>
void function1(file_a);
int main()
{
FILE *file_a = fopen("input.txt", "r");
if (file_a != NULL){
void function1(file_a);
}
else{
}
}
void function1(file_a)
{
while(!feof (file_a)) <<<<<<<<
{
}
}
+3
source to share
3 answers