I have given a function foo(struct node *n)
where n
is the head node in a linked list.
Now foo
should change n
s.t. it points to the end of the list.
But is this possible with this function signature?
Assuming t
is the pointer to the end of the list:
n = t
won't work because the pointer is passed by value.
*n = *t
won't work because I would overwrite the head of the list.
Did I miss something?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…