Example 83: Sorting Names

Learn how to sort names stored in a string array.


You are given an array of pointers to strings. Write a function to sort this array so that the strings are arranged in ascending order. Remember to print the strings on the console.


Input Output
Rajesh Ashish Milind Pushkar Akash Akash Ashish Milind Pushkar Rajesh

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.