I am trying to write a function that takes a user submitted string and creates two pointers; one pointing to the first index of the string and one pointing to the last index of the string. I am getting an error when I try and set the pointers equal to the specific indexes firstPointer = userString[0];
secondPointer = userString[userString.length() - 1];. The error i'm receiving is appearing on the = operator and says "A value of type char can not be assigned to an entity of type char".
I've read several other posts on stackoverflow and I don't think they're addressing the same issue or it's plausible i'm not understanding what they're recommending. I'm fairly new to C++ and am new to pointers. You can ignore the for loop I was just setting that up when I realized my assignment of the pointers was throwing an error. Please find the function code below:
Function
void ReverseString(string &userString)
{
char *firstPointer;
char *secondPointer;
firstPointer = new char;
secondPointer = new char;
firstPointer = userString[0];
secondPointer = userString[userString.length() - 1];
//Iterate over entire string
for (int loopCounter = 0; loopCounter < userString.length()/2; loopCounter++)
{
}
}