I’m looking for a simple, easy to understand algorithm to alphabetically sort an array of characters in C.
I’m looking for a simple, easy to understand algorithm to alphabetically sort an array
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
characters in C have numeric values that happen to be in order, so you just treat your characters like integers. the C standard library includes a ‘qsort’ function. Use that (
man qsorton a linux-like system). You might have to convert upper-case letters to lowercase to simplify things, but that’s trivial. If you want to understand the quicksort algorithm (that’s the one you should learn, because you’ll actually use it), see Wikipedia.