Question: Why the following code dumps core:-
struct linkedlist
{
int *element;
struct linkedlist *link;
}
/*...main starts here...*/
main()
{
......
}
Answer: Did you notice the missing ';' after the struct definition (before main)? That's the reason. In the above case, it assumes that main returns a struct of type 'linkedlist'.
![]() |
No comments:
Post a Comment