assigning ojne string object to another problem

hi to all, I've centos 7 in VM, and trying to assign one array of strings to another. i did like this :-

string choices[]// some where in file
...
// some where in other file

std::string Conn::menu[11] ={
"1. Show All Products",
"2. Add New Product.",
"3. Add New Members.",
"4. View An Existing Product Records.",
"5. View An Existing Member's Record.",
"6. Billing.",
"7. Today's Sail.",
"8. Modify Product Record.",
"9. Modify Member's Record.",
"10. Instructions.",
"11. Exit.",
};

// and want to create and initialize as :-

string option[choices->size()];
int counter = 0;
while(choices->compare("NULL") != NULL)
{
option[counter] = choices[counter];
counter++;
}

now how to assign choices . please help me
you cannot have a variable be a size to a C style array.
use a vector if the size is unknown:
vector<string> option (choices->size());

If you actually don't want a vector (which is certainly preferred) you can also allocate the array dynamically:

string* option = new string[choices->size()];

You need to delete it somewhere when it is not longer needed though.
Topic archived. No new replies allowed.