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)
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)
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.