#include <iostream>
#include <string.h>
using namespace std;
void reverseing(char* st)
{
int size, i;
char *begin, *end, ch;
size = strlen(st);
begin= st;
end = st;
for (i = 0; i < size - 1; i++)
end++;
for (i = 0; i < size / 2; i++) {
ch = *end;
*end = *begin;
*begin = ch;
begin++;
end--;
}
}
int main()
{
char str[100];
cout<<"Enter a string:\n";
cin>>str;
reverseing(str);
cout<<"The reverse string is: %s\n"<<str;
return 0;
}
Comments
Leave a comment