hi
i have a linked list in another linked list
I have a function insertToList(), in the function i haveCode:/* the branch linked list */ struct nodebranch{ unsigned int offset; unsigned char data[130]; struct nodebranch *next; }; struct node{ unsigned int id; struct nodebranch *branch; struct node *next; };
struct node *current;
to point to the current node position of the list. in the function, i will call insertToBranch()
static void insertToBranch(struct node **bufferNode, L2_IDU l2idu);
to insert data into the branch linked list from the list node current. i call the function use:
insertToBranch(&(current->branch), l2idu);
current->branch is the node linked to branch(another linked list), the data will be inserted to that linked list.
l2idu is a data structure and is not important for this question.
in the insertToBranch() function, i have
void insertToBranch(struct node **bufferNode, L2_IDU l2idu){
struct nodebranch *currentbranch;
....
which i use to point to the current position of the *bufferNode.
but while i do that
currentbranch = *bufferNode;
i got a seg fault!??
i know if i pass a linked list reference, thats the rite way to do, but not sure about pass a linked list which is in another linked list.
anyone has any idea?
ps. im quit sure the seg fault is caused by pointing currentbranch to *bufferNode.
cheers
dave



LinkBack URL
About LinkBacks


