Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. int compare_ints(const void *p, const void *q) {
  3. int x = *(const int *)p;
  4. int y = *(const int *)q;
  5. if (x < y)
  6. return -1;
  7. else if (x > y)
  8. return 1;
  9. return 0;
  10. }
  11. int atoi(const char *str);
  12.  
  13. int main(int argc, char **argv)
  14. {
  15. int i = 0;
  16. for(i=0; i<argc; i++)
  17. {
  18. int temp = atoi(argv[i]);
  19. }
  20. qsort(argv, i, sizeof i, &compare_ints);
  21. for(int i=0; i<argc; i++){
  22. printf("%s ", argv[i]);
  23. }
  24. printf("\n");
  25. return(0);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement