Code:
struct node* AppendNode(struct node** headRef, int num) {
struct node* current = *headRef;
// special case for the empty list
if (current == NULL) {
Push(headRef, num); ->why not use & in front of headref?
} else {
// Locate the last node
while (current->next != NULL) {
current = current->next;
}
// Build the node after the last node
Push(&(current->next), num);
}
}
i tried to practice linked list, this is code to add node using push, but i was confuse in this part, Push(headRef, num);
,in here why not using ampersand for &headref? if the argument is only headref, is it only copy the pointer to the push function?