if target node found then enter this condition
if ( root -> data == target_node -> data ) { if ( next == NULL ) cout << " inorder ▁ successor ▁ of ▁ " << root -> data << " ▁ is : ▁ null STRNEWLINE " ; else cout << " inorder ▁ successor ▁ of ▁ " << root -> data << " ▁ is : ▁ " << next -> data << " STRNEWLINE " ; } next = root ; inorderSuccessor ( root -> left , target_node , next ) ; }