Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct nn
- {
- int num;
- }non;
- int cmp(const void *a,const void *b)
- {
- non *aa= (non *)a;
- non *bb= (non *)b;
- if(aa->num>bb->num) return 1;
- else return -1;
- }
- int main()
- {
- non data[100];
- int n,i;
- scanf("%d",&n);
- for(i=0;i<n;i++) scanf("%d",&data[i].num);
- qsort(data,n,sizeof(non),cmp);
- for(i=0;i<n;i++) printf("%d ",data[i].num);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement