0

I am getting seg fault. I am not being able to determine error by debugger.

 bool unload(wordtree* del)
{
if(del==NULL)
return true;

for(int i=0;i<27;i++)
{
    if(del->ptr[i]!=NULL)
    {
        del = del->ptr[i];
        unload(del);
    }
}
free(del);

  return true;
}
5
  • Are you using a trie in this case ?
    – A.Emad
    Dec 9 '16 at 17:59
  • yes i am using a trie Dec 10 '16 at 2:46
  • I suggest you do it recursively. Add an argument head to your unload function and everytime you pass the next head (node) to the unload function
    – A.Emad
    Dec 10 '16 at 22:59
  • still receiving segmentation fault. I have edited code as you said Dec 11 '16 at 1:38
  • Try debugging it using gdb. Make a break point at the unload function and try to figure out what is going on with your code
    – A.Emad
    Dec 11 '16 at 12:11

You must log in to answer this question.

Browse other questions tagged .