#include <stdio.h> #include<string.h> #define N 10 int main() { int i; char s[10][20],*p[10]; int sort(char *q,int n); printf("INput %d string :\n",N); for(i=0;i<N;i++) { p[i]=s[i]; gets(p[i]); } printf("\n"); for(i=0;i<N;i++) printf("%s\n",p[i]); sort(p,N); printf("\nAfter sorted :\n"); for(i=0;i<N;i++) {printf("%s\n",p[i]); } } int sort(char *q[],int n) { int i,j; char *t; for(i=0;i<n-1;i++) for(j=0;j<n-1-i;j++) if(strcmpy(q[j],q[j+1])>0) { t=q[j]; q[j]=q[j+1]; q[j+1]=t; } }