I have a header file named store.h which contains a struct and my main is located in E.c,i am currently experiencing an error which i can not comprehend why it is happening. Any help is much appreciated
store.h:
struct st{
char *buf,*var;
int line_number;
char *keywords;
char *operators;
};
E.C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "store.h"
#define max 1000000
int main(int argc,char *argv[]){
FILE *fp;
int ag=0;
fp=fopen( argv[1],"r");
if(fp==NULL){
printf("error cannot open file\n");
exit(1);
}
while(feof(fp)==0){
*buf=fgets(*buf,max,fp);
// irrelevant commands follow
}
fclose(fp);
}
On the line *buf=fgets(*buf,max,fp);
I get the error:‘buf’ undeclared (first use in this function)
, however I have declared it in my struct and I have included the file that contains the struct, where am I wrong?