Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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:
"stdafx.h"#include #include #include
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!