Hello,
i tried running this program but couldn't after having a look at about 30 mins i still couldn't understand what wrong am i doing. I will leave that upto you now. Below is the code..
why can't q.first's address be assigned to a pointer and why can q.d's address be assigned to pointer?Code:#include <iostream.h> class linklist { struct node { int data; struct node *next; }*first; int *d; public: friend void display(linklist); }; void display(linklist q) { struct node *temp=q.first; int *t=q.d; } int main(void) { linklist q; display(q); return 0; }
and if i want to assign the node's address to some other pointer via friend function then how can i do??