diff --git a/sort a string array in ascending order b/sort a string array in ascending order new file mode 100644 index 0000000..75ad52a --- /dev/null +++ b/sort a string array in ascending order @@ -0,0 +1,25 @@ +#include +#include +void main() +{ + char str[100],ch; + int i,j,l; + + printf("\n\nSort a string array in ascending order :\n"); + printf("--------------------------------------------\n"); + printf("Input the string : "); + fgets(str, sizeof str, stdin); + l=strlen(str); + /* sorting process */ + for(i=1;istr[j+1]) + { + ch=str[j]; + str[j] = str[j+1]; + str[j+1]=ch; + } + printf("After sorting the string appears like : \n"); + printf("%s\n\n",str); + } +