So, I need to salvage this large program for my assignment, but I cannot make sense of the error I'm getting for this string array in a function.
At the = of stockSymbol = """"
I keep getting the error
'Error:a value type "const char *" cannot be assigned to an entity of type "std::string *"
I included where the string is defined and the function. Anyone have any ideas on what's happening and how to fix this?
int menu()
{
int actents = 0;
int opt = 0;
string stockSymbol[MAXENTS];
double stockShares[MAXENTS];
double stockPrice[MAXENTS];
int opt;
string opts;
void resetPortfolio(string stockSymbol[], double stockShares[], double stockPrice[], int & actents)
{
// code logic to set all entries of the stock symbol array to ""
stockSymbol = "\"\"";
// code logic to set all entries of the other arrays to 0
stockShares = 0;
stockPrice = 0;
// set the number of actual entries in the arrays (actents) to 0
actents = 0;
return;
}
string stockSymbol[]in a function declaration makesstockSymbola pointer to astring, not an array ofstrings, even though it looks like an array ofstrings.