Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- int cmp(const void *a, const void *b) {
- return *(int*)a - *(int*)b;
- }
- int main() {
- int n;
- scanf("%d", &n);
- int *arr = (int*)calloc(n, sizeof(int));
- assert(arr != NULL);
- for (int i = 0; i < n; i++) {
- scanf("%d", &arr[i]);
- }
- qsort(arr, n, sizeof(int), cmp);
- for (int i = 0; i < n; i++) {
- printf("%d ", arr[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement