Recursion subsequences NULL

why its print the NULL

hello @Vikaspal
call functions in this order
image

@aman212yadav why the previous one is not working??
After assing the a at j index i am overwriting with \0 character…

yeah that is the reason .
ur all string will have \0 at each index.
that why u r getting empty string in ur output.

@aman212yadav i dry run both the code but getting the same output . But my approaches when i am assign the values and overwrite it with \0 values printing the null character only. i didn’t get this. Can we please draw the recursion tree diagram with i , j pointer why is printing the null only…

image
see these two lines.
after ur first function call out[j] will replace by ‘\0’
because u r calling on same j.
u can interchange line 41 with 42 to resolve this problem.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.