trie - Bus error 10 in Radix Tree C program -


i'm writing program operations on radix trie , i'm stuck @ add() function, getting bus error 10.

void addrec(struct tnode *p, char *w) {    int matches = prefixmatch(p->word,w);    bool insert = true;    if ((p == root) ||    ((matches > 0) && (matches < strlen(w)) && (matches == strlen(p->word)))) {       char *updatedword = &w[matches];         printf("%s\n", updatedword);      struct tnode *tmp = p->child;     while (tmp != null) {       if (tmp->word[0] == updatedword[0]) {         insert = false;         addrec(tmp, updatedword);       }       tmp = tmp->brother;     }     if (insert) {       addchild(p,updatedword);     }      } else if ((matches > 0) && (matches == strlen(w)) && (matches == strlen(p->word))) {     if (p->count < 0) p->count = ++globalcount;     else printf("ignored");     } else if ((matches > 0) && (matches < strlen(w)) && (matches < strlen(p->word))) {     struct tnode *tmp = malloc(sizeof(struct tnode));     tmp->word = &p->word[matches];     p->word[matches+1] = '\0';     tmp->child = p->child;     tmp->count = p->count;     tmp->brother = null;     p->child = tmp;     p->count = -1;    }    } 

the error appears somewhere inside while loop can't figure out , what's wrong exactly. please help.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -