C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Code Snippets sample source codes
A bubblesort routine
A bubblesort routine # include
# include
void bubblesort(int array[],int size); void main() { int values[10],j; for(j=0;j<10;j++) values[j] = rand()%100; /*unsorted*/ printf("\nUnsorted values.\n"); for(j=0;j<10;j++) printf("%d ",values[j]); /*sorted*/ printf("\nSorted values.\n"); bubblesort(values,10); for(j=0;j<10;j++) printf("%d ",values[j]); } void bubblesort(int array[],int size) { int tmp ,i,j; for(i = 0;i
Privacy Policy
|
Link to Us
|
Links