C Program to Implement Lexical Sorting

This is the c program to sort strings (lexical sorting) given n number of strings it will sort the strings in alphabetical order

[cc lang=”c”]
#include
#include

main()
{
char n[100][100];
int i=0,item;
printf(“ENTER THE NUMBER OF ITEMS TO BE SORTEDn”);
scanf(“%d”,&item);
printf(“ENTER THE ITEMS TO BE SORTEDn”);
while(i0)
{
strcpy(temp,str[j-1]);
strcpy(str[j-1],str[j]);
strcpy(str[j],temp);
}
}
}
printf(“nTHE SORTED LISTn”);
for(i=0;i

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *