adding a node to a linked list.
Posted
by sil3nt
on Stack Overflow
See other posts from Stack Overflow
or by sil3nt
Published on 2010-05-18T03:25:21Z
Indexed on
2010/05/18
3:30 UTC
Read the original article
Hit count: 335
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;
}
© Stack Overflow or respective owner