fork download
  1. #include <stdio.h>
  2.  
  3. void reverse(char *str);
  4. void test(char *str);
  5. int main() {
  6. char * h = "Hello World\n";
  7. printf("%s", h);
  8. test(h);
  9. reverse(h);
  10. printf("%s", h);
  11. }
  12.  
  13. void test(char *str) {
  14. printf("test %s", str);
  15. }
  16.  
  17. void reverse(char *str) {
  18. char * end = str;
  19. char tmp;
  20. if (str) {
  21. while (*end) {
  22. printf("while %s", end);
  23. ++end;
  24. }
  25. --end;
  26. while (str < end) {
  27. tmp = *str;
  28.  
  29. printf("swapwhile %c\n", tmp);
  30. *str = *end;
  31. str++;
  32. // *str++ = *end;
  33. *end-- = tmp;
  34. }
  35.  
  36. }
  37. }
  38.  
Runtime error #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
Standard output is empty