fork download
  1. #include <stdio.h>
  2.  
  3. void stringReverse(const char *s);
  4.  
  5. int main(void) {
  6. char string[] = "Hello world";
  7.  
  8. printf("Original string: %s\n", string);
  9. printf("Reversed string: ");
  10. stringReverse(string);
  11. printf("\n");
  12.  
  13. return 0;
  14. }
  15.  
  16. void stringReverse(const char *s) {
  17. if (s[0] == '\0') {
  18. return;
  19. }
  20.  
  21. stringReverse(&s[1]);
  22. putchar(s[0]);
  23. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Original string: Hello world
Reversed string: dlrow olleH