write a program to get a 2 d character array and arrange them in alphabetical order.
i've tried it,but its not getting compiled.
im jus a beginner.so, someone plz help me.
given below is my program....
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct st{
char a[5][10];
}ppl;
int main()
{
int i,j;
char b[10];
for(i=0;i<5;i++)
{
printf("enter the name of the %d person :",i+1);
scanf("%s",ppl.a[i]);
}
printf("the names after arranging in alphabetical order:\n\n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(ppl.a[i][1]>ppl.a[i+1][1])
{
b=ppl.a[i];
ppl.a[i]=ppl.a[i+1];
ppl.a[i]=b;
}
}}
for(i=0;i<5;i++)
{
printf("the name of the %d person is %s\n",i+1,ppl.a[i]);
}
getch();
return 0;
}