Move all X end using swap and reccursion


Due to which line its giving me a segmentation fault???
and how to correct this error in my code

Hey @apoorv.chauhann you are getting segmentation fault because of condition in your while loop.

ok …what is wrong in that

i gave that condition so that j could point to character which is not ‘x’ and then move to swap condition

Okay do one thing instead of making you j=I+1 make it equal to J=I and keep everything same. I got your logic. It will work if you keep j=i, :slight_smile:

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.