Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void inverse(char* buffer)
{
int end = strlen(buffer)-1;
int begin = 0;
for(;begin<end;begin++,end--)
{
buffer[begin]^=buffer[end]^=buffer[begin]^=buffer[end];
}
}
#include <iostream.h>
#include <string.h>
char *inverse( char *str )
{
unsigned int len = strlen(str);
char *cp = new char[len+1];
int j = 0;
for( int i = len - 1; i >= 0; i-- )
{
cp[j] = str[i];
j++;
}
cp[j] = 0;
strcpy( str, cp );
delete cp;
return str;
}
void main()
{
char str[20] = {"Hello world !"};
cout<<inverse(str)<<endl;
}
// output: ! dlrow olleH