Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void revert(char* left, char* right) {
  5. if(left == right) return;
  6.  
  7. char *ll = left; char* rr = right;
  8.  
  9. char tmp = right[0];
  10. right[0] = left[0];
  11. left[0] = tmp;
  12. revert(++ll,--rr);
  13. }
  14.  
  15. int main() {
  16. char rev_string[] = "Some teststring";
  17. printf("%sn", rev_string);
  18. revert(&rev_string[0],&rev_string[strlen(rev_string)-1]);//rev_string[strlen(rev_string)-1]);
  19. printf("%sn", rev_string);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement