Original Post
Hey, I'm trying to make a program that reverses the string that the user inputs in, but I'm having some problems compiling and I can't see the typo that I've made.
#include <iostream>
#include <string>
using namespace std;
void reverseString(string& string);
int main (int argc, char * const argv[])
{
string s;
cout << "Enter a string: ";
getline(cin, s);
reverseString(s);
cout << "Reversed string = " << s;
return 0;
}
void reverseString(string& string)
{
int strLength;
string rvrString; // Line where I'm getting the error
strLength = string.length();
for (int j = 0, i = strLength - 1; i <= 0; i--, i++)
{
}
}
Quote:As far as i can see, I haven't left out any semicolons, so why am I getting this error? Any help would be appreciated. Thanks.
expected ';' before 'rvrString