I try to iterate through a string char by char. I tried something like this:
void print(const string& infix)
{
char &exp = infix.c_str();
while(&exp!='\0')
{
cout<< &exp++ << endl;
}
}
So this function call print("hello"); should return:
h
e
l
l
o
I try using my code, but it doesn't work at all. btw the parameter is a reference not a pointer. Thank you