Binary tree to DLL

I am done this question using inorder traversal but my code isnt running properly. please check it once .
QUESTION LINK :: https://practice.geeksforgeeks.org/problems/binary-tree-to-dll/1
CODE LINK:: https://ide.codingblocks.com/s/99407

Can you send your entire code?

You are doing it wrong, due to the following declaration:
Node *prev==nullptr;

Every time your function is called recursively, then a new pointer prev in that scope is declared pointing to NULL.

So, you are not keeping track of previous node of the list.

Try, to resolve it yourself.
Hope, this would help.