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;
	   }
	}
}

Last edited by shabbir; 26Sep2006 at 10:38.. Reason: Code formating.