/* Parray Program */ #include #include #include #include #include #include #include void Pause() { printf ("\n Press Anykey to continue..."); getch (); } void ssort (char *p [], int n) int main () { clrscr (); /* "main prorgam lines" go here */ char name [80]; puts ("What is your name?"); gets (name); puts ("\nHello,"); puts (name); char *pie [] = {"three", ".", "one", "four"}; int i, total; total = sizeof (pie) / sizeof (char *); for (i = 0; i < total; i++) { printf ("pie [%d] ==%d\t->\t", i, pie[i]); puts (pie [i]); } ssort (pie, total); for (i = 0; i < total; i++) { printf ("pie [%d] ==%d\t->\t", i, pie[i]); puts (pie [i]); } Pause (); return 0; } void ssort (char *p [], int n) { int a, b; char *x; for (a = 1; a < n; a++){ for (b = 0; b < n - 1; b++){ if (strcmp (p [b], p [b + 1]) > 0){ x = p [b]; p [b] = p [b + 1]; p [b + 1] = x; } } } }