Code:
char choice = 'a';
if( lvl == 5 ) return;
tmp=(Node*)malloc(sizeof(Node));
for(c = 0; c < 3; c++)
tmp->child[c] = NULL;
//avoid same opt siblings
//won't work. WHY ????
for(c = 0; c < 3; c++){
if( mother->child[c] != NULL){
if(choice == mother->child[c]->opt){
choice++;
}
}
}
if(choice > 'f'){
free (tmp);
return;
}
How are you supposed to get from 'a' to 'f' in only 3 iterations?
You may as well bail at the first match.
Code:
if(choice == mother->child[c]->opt){
free (tmp);
return;
}
No I haven't tested it.