Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include<string.h>
  2. #include<stdlib.h>
  3. #include<stdio.h>
  4.  
  5.  
  6. int main (){
  7.  
  8. char** text = calloc(3, sizeof(char*));
  9.  
  10. for(int i = 0; i < 3; i++)
  11. text[i] = (char*) calloc(10, sizeof(char));
  12. // clD dSn sae
  13. text[0][0] = 'd'; // a > b > A
  14. text[0][1] = 'S'; // 293
  15. text[0][2] = 'n';
  16. text[0][3] = '\0';
  17. text[2][0] = 'c';
  18. text[2][1] = 'l'; // 275
  19. text[2][2] = 'D';
  20. text[2][3] = '\0';
  21. text[1][0] = 's';
  22. text[1][1] = 'a'; // 313
  23. text[1][2] = 'e';
  24. text[1][3] = '\0';
  25.  
  26. //printf("%d\n\n", strcmp(text[0], text[2]));
  27.  
  28. qsort(text, 3, sizeof(char*), (int (*)(const void *, const void *)) strcmp);
  29.  
  30. for(int i = 0; i < 3; i++)
  31. printf("%s\n", text[i]);
  32.  
  33. return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement