Hi , Can any one help me.I need the C coding for sort n number of names using pointers and functions in alphabetical order.plz help me. -Sakthi
Code: #include<string.h> #include<stdio.h> #include<stdlib.h> void bubble(char *items, int count); void main() { char s[255]; clrscr(); printf("\nEnter a string : "); gets(s); bubble(s, strlen(s)); printf("\nThe sorted string is : %s", s); getch(); } void bubble(char *items, int count) { int a, b; char t; for (a = 1; a < count; a++) for (b = count - 1; b >= a; b--) { if(items[b-1] > items[b]) { t = items[b-1]; items[b-1] = items[b]; items[b] = t; } } }