Hi All,
The following abstract of code compiles with no warnings using gcc (C90). 'printf' reveals that it refuses to enter the function without a seg fault being produced. I can't get my head around it. Surely it must enter the function?!
Any hints would be appreciated.
Code:
List * makelist( char* *wrd, List* *lst ) { /*seg fault here*/
List* dest = NULL ;
List* temp_lst = NULL ;
/*malloc for lst, plus other stuff here*/
return *lst
}
int main() {
char* wrd ;
List* lst = NULL ;
/*wrd becomes a pointer to a string. wrd can be NULL.*/
lst = makelist( &wrd, &lst ) ;
return 0;
}