I have written code to reverse a string in c... it works fine but I can\'t return the reversed string in the main() function.
main()
#include
#include using namespace std; reverse( char *str) { if (*str!='\0') { reverse(str+1); cout<<*str; } //cout<<*str when i am just printing here then why this is printing after one space ?? } int main() { string a ; cin>>a; reverse(&a[0]); return 0; }