I've been trying everything under the sun to do the simple following:
1) Receive an input string from stdin.
2) Convert it to a char pointer so I can pass to a tabling/palindrome finding function.
I'm confident in the latter part of step 2, but it's the type agreement I can't hack. Below is my main body in question. The prototype of the palin function is int palin(char *str)
.
int main()
{
string input;
cin >> input;
char seq[] = input.c_str(); //Error here, invalid initialization?
int len = strlen(seq);
int result = palin(seq);
cout << result;
getchar();
return 0;
}
Any ideas? c_str()
conversion also presents a problem as it expects a constant pointer char, but my char pointer will change.