//purpose: to reverse the order of a word or a sentence. eg) program -> margorp.
#include <iostream>
usingnamespace std;
void msg()
{
char ch;
cin.get(ch);
if (ch != '.')
{
msg();
}
cout << ch;
}
int main()
{
msg();
system ("pause");
return 0;
}
If ch is global it contains the very last input character which is the dot, otherwise you won't see any output.
if ch is local it is pushed/popped to/from the stack each time msg() is called.