My function definition won't compile because of a supposedly "undeclared" structure member. It says "error: βgenβ undeclared". But I declare it and even initialize it afterwards (I left that part out for simplicity). Can you see why this wont compile?
my structure:
typedef struct Parent {
int gen; //I DECLARE IT RIGHT HERE!!!
char *name;
struct Parent * next;
child * child;
} parent;
and my function:
void findP(parent* x){ //function findP
headP = p;
tempC = headP->child;
int check = 0;
while(headP != NULL){
while(tempC != NULL){
if (x->name == tempC->name){
x->gen = gen--; //HERES WHERE I USE IT
findP(headP); //recursion here
check++;
break;
}
if(check > 0) break;
tempC = tempC->next;
}
if(check > 0) break;
headP = headP->next;
}
}