Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. char reversedStr[101] = "";
  6. int count = 0;
  7.  
  8. void reverse(char []);
  9.  
  10. int main(int argc, char **argv){
  11. for(int i = argc - 1; i >= 0;i--){
  12. reverse(argv[i]);
  13. printf("%s\n", reversedStr);
  14. strcpy(reversedStr, "");
  15. }
  16.  
  17. return 0;
  18. }
  19.  
  20. void reverse(char input[]){
  21. for(int j = strlen(input) - 1; j >= 0 ; j--){
  22. reversedStr[count] = input[j];
  23. count++;
  24. }
  25. reversedStr[count] = '\0';
  26. count = 0;
  27. return;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement