fork(4) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void reverse(char str[]) {
  5. int len = strlen(str) ;
  6. char tmp;
  7. for (int i = len / 2; i >= 0; i--) {
  8. tmp = str[i];
  9. str[i] = str[len - i - 1];
  10. str[len - i - 1] = tmp;
  11. }
  12. }
  13.  
  14. int main(void) {
  15. char str[] = "123";
  16. reverse(str);
  17. printf("%s", str);
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/37031/101
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
321