Please tell me What's being wrong in this code


Please tell me What’s being wrong in this code

  1. Use strcmp() to compare strings.
  2. Output should be printed in sorted order which your code won’t do.

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.

Sir I wanna make this way. Please tell me how to solve this one.

I already told you. Edit the changes I mentioned above and the code should work. If it doesn’t, give me the link with the edited code.

@cbcao263 you are passing s, which is an array of a string. But in the function you have defined that as char * , it should be string * instead. But then it wont have the functionality of a single character array, which you are trying to do. I’d suggest you take a moment to dry run this code and maybe you’ll get what i’m saying.
You can avoid this mess and extra memory usage by passing a char array instead and printing the “op” char array in the base case itself instead of storing everything in a separate array.

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.