I am somewhat baffled.
I read a string literal from the keyboard and want to print it in reverse. Quite simple.
Ok and on my Mac in Xcode I get "Bad Exec" and on my PC using Ubuntu it doesn't even run.Code:
for(string::size_type x = str.size(); x >= 0; x--)
cout << str[x];
cout << endl;
Anyone care to explain why this does not work?
It is interesting to me that x != 0 results in a reversal of the string less the last index. x != -1 works fine but x >= 0 results in "EXEC_BAD_ACCESS"?