|
|
back to boardwhy crash ???? Posted by Brian 18 Oct 2007 10:07 #include <stdio.h> #include <stdlib.h> int sort(const void* a, const void* b) { int* x = (int*)a; int* y = (int*)b; if(*x > *y) return 1; else if(*x < *y) return -1; else return 0;
} int main() { int n,a,array[100],cant = 0; scanf("%d",&n); for(int i=0;i<n;i++) for(int y=0;y<n;y++) { scanf("%d",&array[cant++]); } qsort(array,cant,sizeof(int),sort); for(int u=0;u<cant;u++) printf("%d ",array[u]); printf("\n"); return 0; } |
|
|