Write A Program for sorting of n strings
#include<stdio.h> #include<conio.h> # include < string.h > void main ( ) { char str [20] [15],s[15]; int i...
https://www.computersprofessor.com/2016/06/write-program-for-sorting-of-n-strings.html
#include<stdio.h>
#include<conio.h>
# include<string.h >
void main ( )
{
char str [20] [15],s[15];
int i,j,n;
printf (“enter how many strings”);
scanf ( %d”, &n);
printf (“\n enter strings”);
For ( i =0; i < n, i++)
scanf ("%s” str [i]);
for ( i =0; i < n-1; i++)
{
for ( j = i +1; j < n; j++)
{
if (strcmp ( str [i], str [j])
> 0)
{
strcpy ( s, str [i]);
strcpy ( str [i], str [j]);
strcpy ( str [j], s);
}
}
}
printf (“\n After sorting strings are \n”);
for ( i =0, i < n; i++)
printf (“\n %s”, str [i]);
getch ( );
}






























