Interesting C Programs
A Collection Of Weird and Interesting C Programs by Balaji
Friday, November 2, 2007
Sorting Algorithm - 1 (BUBBLE SORT)
A very primitive, simple and Well known Sorting algorithm.
void bubble_sort(char *str, int count)
{
int i,j;
for(i=0;i
<
count;i++)
{
for(j=count-1;j>i;j++)
{
if(str[j-1]>str[j])
{
swap_terms(&str[i],&str[j]);
}
}
}
}
void swap_terms(char *a,char *b)
{
(*a)^=(*b)^=(*a)^=(*b);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Search Google
Get great free widgets at
Widgetbox
!
Books that I refer to...
The Complete Reference C, Fourth Edition
The C Programming Language
Some Useful Stuff for my reference
Files in C
Tutorial on Function Pointers
Understanding the system.map file
Using GNU's GDB
Site on PC Fundamentals
GNU-GCC Internals
GOOGLE, My All Time Favourite Search Engine
WIKIPEDIA
OPEN GROUP ONLINE PUBLICATIONS
No comments:
Post a Comment