Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. typedef unsigned char byte;
  6. #define SIZE 100
  7.  
  8. char** mix_word(const char *word)
  9. {
  10. int length = strlen(word);
  11. char **list = malloc(sizeof(char*) * length);
  12. char s;
  13. for (int j = 0; j < length - 1; j++)
  14. {
  15. list[j] = malloc(sizeof(char)* (length + 1));
  16. strcpy(list[j], word);
  17. s = list[j][j];
  18. list[j][j] = list[j][j + 1];
  19. list[j][j + 1] = s;
  20. }
  21. list[length - 1] = NULL;
  22. return list;
  23. }
  24.  
  25. char del_word(char *word)
  26. {
  27.  
  28.  
  29. return word;
  30. }
  31.  
  32. int main()
  33. {
  34. char ** result = mix_word("lenght");
  35. int i = 0;
  36. while(result[i] != NULL)
  37. {
  38. printf("%s\n", result[i]);
  39. free(result[i++]);
  40. }
  41. free(result);
  42.  
  43. printf("\n");
  44. //del_word(word);
  45.  
  46. getchar();
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement