Https://ide.codingblocks.com/#/s/21225

Why is s[0] empty in this case?
How can I rectify this?

In array of characters or string last element is the null character.
When you sort the array this null character comes at s[0].
I hope you get your mistake…

no , that sort is not for sorting string elements but the set of strings.
Even if I dont include it I get s[0] as “\0”.