just curious why this isnt working... its probably simple..
but its a friday so im allowed to not access my brain as much...
anyways... i want to input a string then switch that to a char array
then switch back and print reversed string
this doesnt work...
debugger stops it at output.at(x).... but doesnt tell me why.
#include <iostream>
#include <cstring>
using namespace std;
int main () {
string input;
string output;
char bob[20];
int y = 0;
int x = 0;
cin >> input;
cout << endl;
int length = input.length();
cout << length;
for (y = 0; y < length; y++)
bob[y] = input.at(y);
for (y = (length -1 ); y >= 0; y--) {
output.at(x) = bob[y];
x--;
}
cout << output;
return 0;
}