0

enter image description here

it's taking forever and I have no clue if there's a logic fail since I have run my own local program using tries to implement check using a few user entered words and then looking for the word which works like a charm but then using the same logic I get this. I would really appreciate some help. Thanks.

4
  • 1
    Impossible to know what's going on without seeing some code. However, it sounds like it's in an infinite loop. Suggest you start by figuring out where it is happening. You could add some strategically placed printf statements at the start of each function (load, check, etc.) and see which executes. Once you identify which function, narrow it down to which particular loop, and then try to see what is causing an infinite loop. I'd start here before running in gdb since it could take a long time to step through the program to get to the problem, but then gdb could be really helpful.
    – Cliff B
    Commented Oct 8, 2015 at 17:11
  • thank you, I was frustrated to the extent where I couldn't think of the life savor printf. I would most certainly try that Commented Oct 8, 2015 at 17:22
  • I'm having a problem with the load function in trie. Commented Oct 8, 2015 at 18:03
  • I found the problem. It prints until the "assigned ptr" and that's it. Then the program gets stuck. It doesn't print "entering while loop". Here's the code: void loadIntoTrie(const char* word, int length) { printf("\ninside loadIntoTrie"); int itr = 0; node* ptr = (node*)malloc(sizeof(node)); printf("\ndeclared ptr"); ptr = head; printf("\nassigned ptr"); printf("\nentering while loop"); while (itr <= length) Commented Oct 8, 2015 at 18:12

0

You must log in to answer this question.

Browse other questions tagged .