The following program is supposed to sort eight strings in alphabetical order, but its not functioning properly. Can anyone please debug this
void main()
{
char *p[8], *s;
int i,j,t;
clrscr();
printf("Enter the strings:\n");
for(i=0;i<8;i++)
gets(p[i]);
for(i=0;i<8;i++)
{
for(j=i+1;j<8;j++)
{
t=strcmp(p[i],p[j]);
if(t>0)
{
s=p[i];
p[i]=p[j];
p[j]=s;
}
}
}
printf("\nSorted strings:\n");
for(i=0;i<8;i++)
puts(p[i]);
getch();
}