c - Segmentation fault & core dumped with changing window size -


i make program using ncurses using window(?).

there strange problem!! (i use putty)

if change window size, deletetree() not working well. if maintain window size, deletetree() working well!!

the function of deletetree()

max_child = 100 enum day {mon, tue, wed, thu, fri, sat, sun}; enum tree_type {header,day,place,room}; typedef struct _tree {     enum tree_type type;     union _info info;     struct _tree* link[max_child]; } tree;  typedef tree* tnode; tnode troot;   void deletetree(tnode* twalk) {     int i;     if (*twalk == null)         return;     (i=0;i < max_child;i++)     {         if ((*twalk)->link[i] != null){             deletetree(&(*twalk)->link[i]);             (*twalk)->link[i] = null;         }else break;     }     free(*twalk);     *twalk = null;  } 

and

void deletetree(tnode twalk) {     int i;     if (twalk == null)         return;     (i=0;twalk->link[i]!=null;i++)     {         deletetree(twalk->link[i]);         free(twalk->link[i]);         twalk->link[i] = null;     }     if (twalk == troot)     {         if (twalk != null)              free(twalk);         troot = null;     }  } 

both of them not working if window size changed. error message segmentation falut(core dumped).

i think error means when change window size makes change location of memory. how solve problem...?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -