//Sort names in alphabetical order
#include <stdio.h>
#include<string.h>
#include<math.h>
#define limit 100
void main(){
char a,b;
int p,j=0;
char str[10][10];
char temp[10];
printf("ENTER NUMBER OF STRING YOU WANT TO ENTER=\n");
scanf("%d",&p);
for(int i=0;i<p;i++)
{
scanf("%s",str[i]);
}
for(int i=0;i<p;i++)
{
printf("%s\n",str[i]);
}
for(int i=0;i<p-1;i++)
{
for(int k=i+1;k<p;k++)
{
if(str[i][0]>str[k][0])
{
for(int u=0;u<10;u++)
{
temp[u] = str[i][u];
str[i][u] = str[k][u];
str[k][u] = temp[u];
}
}
}
}
printf("\n output \n\n");
for(int i=0;i<p;i++)
{
printf("%s\n",str[i]);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: