Connecting Tech Pros Worldwide Forums | Help | Site Map

sorting of strings using C?

Newbie
 
Join Date: Nov 2008
Posts: 1
#1: Nov 19 '08
how can we sort the string eg: "My Name is komal" how can we sort it as per word?

Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,379
#2: Nov 19 '08

re: sorting of strings using C?


Create an array of strings.
Extract each word from "My Name is komal" and place it in the array.
Sort the array.
gpraghuram's Avatar
Expert
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,258
#3: Nov 20 '08

re: sorting of strings using C?


You can use qsort which is available with stdlib.h to sort the array(Which u create by breaking the sentence and pushing the same to array)

Raghu
Reply