How can i convert pointer into string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i convert pointer into string?

struct node{ int data; node* link; }; class Linked{ node* cur, *start , * temp; public: Linked():start(NULL){} void insert(int n){ if(start==NULL){ start = new node; start->data = n; start-> link = NULL; } else{ cur = start; while(cur->link!=NULL) cur =cur->link; temp = new node; temp->data = n; temp->link = NULL; cur->link = temp; } } void display(){ cur = start; initwindow(700,400,"linked list",400,200); while ( cur!=NULL){ outtext(cur->link); cur = cur->link; } } }; outtext() function accepts a string but cur->link is a address how i pass this argument ?

17th Jan 2020, 5:41 PM
Iqra Rehman
1 Answer
+ 2
You don't. Pointers are pointers, strings are strings. If you mean to obtain the value stored at an address pointed to by a string pointer then it's different, dereferencing is not converting. Share your code link within your question Description, so the community can help. Without code review no one can help but to do wild guessings. https://www.sololearn.com/post/74857/?ref=app
17th Jan 2020, 6:06 PM
Ipang