getting segmentation fault
Replace pie recusrion
instead of string you should have to use character array
because in string you can’t change the size of string
i have done some more changes like
at line no 22 n will also increase by 2
Please take a look at Modified code
if you have any doubt you can ask freely
Modified Code
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved 
if you have more doubts regarding this feel free to ask
why on n+2 you have added \0?
‘\0’ should be placed at the ending of character array
so i add it end
if you don’t use this
some garbage will print or segmentation fault occur
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.