Previous | Home | Next |
/** Program of sorting using Array in C **/ #include <stdio.h> #include <conio.h> #include <stdlib.h> int array[] = { 9, 3, 30, 25, 89, 40, 8, 50, 6, 65 }; int sort (const void *x, const void *y) { return (*(int*)x - *(int*)y); } void main() { clrscr(); int i; qsort(array, 10, sizeof(int), sort); for (i=0; i<10; i++) { printf("%d ", array[i]); } getch(); }
Previous | Home | Next |