Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. void reverseChar(char*);
  6.  
  7.  
  8. int main()
  9. {
  10.  
  11. char charArray[50];
  12. cout<< "Please Enter the String: ";
  13. cin.getline(charArray,50);
  14. reverseChar(charArray);
  15. cout<<charArray;
  16. return 0;
  17. }
  18.  
  19. void reverseChar(char* charArray)
  20. {
  21. int length = strlen(charArray);
  22.  
  23. for(int count =0; count < length/2; count++)
  24. {
  25. char temp=charArray[count];
  26. charArray[count]=charArray[length- count - 1];
  27. charArray[length- count - 1 ]=temp;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement