adding a node to a linked list.
- by sil3nt
Hi there, ive been given the following code, And im just wondering, what does *&listpointer mean in the argument of the addnode function?
struct Node {
int accnumber;
float balance;
Node *next;
};
Node *A, *B;
int main() {
A = NULL;
B = NULL;
AddNode(A, 123, 99.87);
AddNode(B, 789, 52.64);
}
void AddNode(Node * & listpointer, int a, float b) {
// add a new node to the FRONT of the list
Node *temp;
temp = new Node;
temp->accnumber = a;
temp->balance = b;
temp->next = listpointer;
listpointer = temp;
}