New to C++ and trying to write a short program to reverse the characters in a word. Im having trouble converting the string to a char array. Here is the code:
using namespace std;
cin >> org;
int num = org.size();
for (int a = num; a >= 0; a--)
cout << reversal[a];
cout << endl;
Im getting three errors. All are on the strcopy() line:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'reversal' : unknown size
Im using Visual C++ to compile.
Any advice you can give is much appreciated and if there is a more efficient way of doing this please let me know. Thanks again!