can anyone help me pls am using turbo compiler.
Write function which will sort string argument in alphabetical order.
You may assume that the strings contain only lower
case letters,
optionally,and no blanks or other non-alphabetic

7 Years
Discussion Span
Last Post by SoulReaper1680

The basic principle is the same as the normal sorting algorithms .. There are many .Its better to start off with bubble sort and selection sort . You can use an array of pointers to store the strings and then compare them using strcmp implement the sorting algos


Do you mean that if you have the string "time" you want "eimt" as the output?

What you could do is store your string in an array of char, and apply bubble or shuttle sort on it. You'll need to compare two consecutive elements (characters) and check whether the 2nd one is smaller than the 1st one. If so, swap them around and move on. If not, move on.

Keep repeating this depending on which algorithm you use.


From what I understood , he wants to sort a number strings and not the characters in a single string

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.