Doing a problem on how to convert a binary tree to a doubly linked list tree in the void po() function we are passing root node and 2 nodes as their address and now i want to set the right of one of the reference node i am doing the below way and getting error anyone know how to solve this ???
void po(Node* root,Node **p,Node**q){
if(p==NULL)
return;
po(root->left,p,q);
if(*p==NULL){
*p=root;
*q=root;
}
else{
*(q)->right=root; // This line contain error !!!
root->left=*q;
*q=root;
}
po(root->right,p,q);
}
Node * bToDLL(Node *root)
{
if(root==NULL )
return root;
Node* a=NULL;
Node* b=NULL;
po(root,&a,&b);
return a;
}
Error :- error: request for member right in * q, which is of pointer type Node* (maybe you meant to use -> ?) *(q)->right=root; ^