Bst flatten a tree

sir why these code not working

sir please reply i wanted to know my mistake in these code

hi @YASHMATHURIA123, I just picked your doubt , i will reply with answer asap

@YASHMATHURIA123, the problem in your code is that you are returning pointer to a garbage value as there is no linkedlist value stored so you have to allocate dynammically a linkedlist explicitly ,So, either pass linkedlist by value or allocated memory address to the pointer you are returning refer code for more clarification.
I have corrected your code :
refer this :-
pass by address :- https://ide.codingblocks.com/s/259028
pass by value :- https://ide.codingblocks.com/s/259020

In case of any doubt feel free to ask :slight_smile:
Mark your doubt as RESOLVED if you got the answer