I'm working on a script to create a linked-list of words (locals) from a file in C. Basically, I want a linked list of the first word of each line. I'm getting the error "incompatible types when assigning to type 'struct local *' from type 't_local {aka struct local}'" and can't figure out what's happening. Help would be very appreciated as I'm struggling a bit with linked lists
typedef struct local{
char *name;
struct local *next;
}t_local;
void crialistalocais(t_local *header){
FILE *fp;
t_local *aux = header->next;
char line[150];
char *name1;
fp = fopen("loclss.txt","r");
while (!feof(fp)){
fgets(line, 100, fp);
namel = strtok(line, '/');
aux->name = namel;
aux->next = *header;
header=aux;
}
}
headeris astruct local *, therefore*headeris astruct local.feof, but the return value offgetslike so:while (fgets(line, sizeof(line), fp)) ...