-1

What is the meaning of Node *&front the below linked list code extract in C++?

 FrontBackSpilit(head,a,b) 

 Node * FrontBackSpilit(Node * head, Node *&front, Node * &back) 
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Rauf javid
  • 77
  • 8

1 Answers1

6

Node *&front

this is a reference to pointer to instance of Node, so if you call FrontBackSpilit like:

Node* pNode1;
Node* pBack;
FrontBackSpilit(NULL, pNode1, pBack);

and FrontBackSpilit will do for example front = new Node, then pNode1 will be assigned this value.

If instead of Node *&front you would have Node *front, then assignment to front will not change pNode1.

marcinj
  • 48,511
  • 9
  • 79
  • 100