sorting set of five string in alphabetical oder throwing warning?
- by rost rost
sorting set of five string in alphabetical oder throwing warning ?my code is below please help me to fix it
#include<stdio.h>
#include<string.h>
int main()
{
char a[5][20],t[20];
int i,j;
printf("enter 5 string\n")
scanf("%s",a);
for(i=1;i<5;i++)
{
for(j=1;j<5;j++)
{
if(strcmp(a[j-1],a[j])>0)
{
strcpy (t,a[j-1]);
strcpy (a[j-1],a[j]);
strcpy(a[j],t);
}
}
}
for(i=1;i<5;i++)
printf("%s\n",a[i]);
}
~