sorting set of five string in alphabetical oder throwing warning?

Posted by rost rost on Stack Overflow See other posts from Stack Overflow or by rost rost
Published on 2014-08-24T04:06:33Z Indexed on 2014/08/24 4:20 UTC
Read the original article Hit count: 108

Filed under:
|
|

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]);
}

~

© Stack Overflow or respective owner

Related posts about c

    Related posts about string