Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cstring>
- using namespace std;
- void reverse(char *&s)
- {
- int length = strlen(s) ;
- int c, i, j;
- for (i = 0, j = length - 1; i < j; i++, j--)
- {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
- }
- int main() {
- char *str="hello";
- cout<<str;
- reverse(str);
- cout<<str;
- // your code goes here
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement