Please tell what will be displayed

class Node{ public:
int data;
Node * next
}; Node *p1 = new Node, *p2 = new Node, *p3 = new Node;

p1->data = 12; p2->data = 34;
p1->next = p2; p2->next = p1;
cout << p2->data<< “ ” << p2->next->data<<endl;
cout << P1->next->data<< “ ” << P1->next->next->data;

P1->data = 12; p2->data = 34;
*P1 = *P2;
cout << p2->data<< “ ” << p2->next->data<<endl;
cout << P1->next->data<< “ ” << P1->next->next->data;

P1->data = 12; p2->data = 34; p3->data = 34;
P1->next = p2; P2->next = p3; P3->next = 0;
cout << P1->data<< “ ” << p1->next->data<< “ ” <<
p1->next->next->data << “ ”<<p3->data;
Please do not double-post. Other thread: http://www.cplusplus.com/forum/general/218874/
Topic archived. No new replies allowed.