Question: #include #include using namespace std; struct node { int data; node * next; } ; void insertN ( node * &head, node * &displayPtr, int
#include
#include
using namespace std;
struct node
int data;
node next;
;
void insertNnode &head, node &displayPtr, int data
node pnode;
pnode new node;
ifpnode NULL
cout"Unable to locate node"data data;
pnodenext NULL;
ifhead NULL && displayPtr NULL
head pnode;
displayPtr pnode;
else
headnext pnode;
head pnode;
void displayNnode displayPtr
node ptr displayPtr;
while ptr NULL
cout ptrdata;
if ptrnext NULL
cout ;
ptr ptrnext;
cout endl;
return;
int main
node head NULL;
node displayPtr NULL;
insertNhead displayPtr, ;
insertNhead displayPtr, ;
insertNhead displayPtr, ;
cout"Nodes in linked list."
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
