String sort https://ide.codingblocks.com/s/292003

why i am getting the wrong output?when i am printing the larger string first

your compare function is not corrrect

in your compare function first line is return statement
so rest of the code will not executed

correct one

bool compare(string a, string b) {
	int i = 0;
	while (a[i] == b[i]) i++;
	if (a[i] == '\0')return false;
	else if (b[i] == '\0')return true;
	return a[i] < b[i];
}

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:

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.