pointer and reference question (linked lists)

Posted by sil3nt on Stack Overflow See other posts from Stack Overflow or by sil3nt
Published on 2010-04-24T00:49:05Z Indexed on 2010/04/24 0:53 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

Hi there, I have the following code

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);
  etc…
}

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;
}

in this here void AddNode(Node * & listpointer, int a, float b) { what does *& listpointer mean exactly.

© Stack Overflow or respective owner

Related posts about pointers

Related posts about c++