Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. #define BUF_SIZE 1024
  5.  
  6. void
  7. reverse_change (char *str)
  8. {
  9. int i;
  10. int str_len = strlen(str);
  11.  
  12. puts("<after reverse..>");
  13. printf("Output string: ");
  14.  
  15. for (i=(str_len - 1); i>=0; i--) {
  16. //printf("[%c]", str[i]); //DEBUG
  17. printf("%c", str[i]);
  18. }
  19. puts("");
  20.  
  21. }
  22.  
  23. int
  24. main (int argc,
  25. char *argv[])
  26. {
  27. char buf[BUF_SIZE];
  28. printf("input string: ");
  29. scanf("%s", buf);
  30.  
  31. reverse_change(buf);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement