FINDING THE STRING WHICH OCCURS FIRST IN ALPHABTICAL ORDER
WITHOUT MODIFYING THE ARRAY
#include <stdio.h>
void main()
{
char
st[10][30],t[30];
int n,i;
printf("how
many strings do u want to enter :");
scanf("%d",&n);
printf("Enter
strings:");
for(i=0;i<n;i++)
{
fflush(stdin);
gets(st[i]);
}
for(i=0;i<n;i++)
if(i==0||strcmp(t,st[i]>0))2
strcpy(t,st[i]);
printf("The string which occurs first in alphabetical
order is %s",t);
}
OUPUT
How many strings do u want to enter :1
Enter strings: abcde
The string which occurs first in alphabetical order is abcde