why the following code using char* doesn't work?
why the following code doesn't work (gives me a general protection fault):
Code:
int MAX = 200;
char *optiondesc[MAX];
int main()
{
...
// get maximum number of options
do
{
cout << "Enter the number of options you want to evaluate:" << endl
<< "(minimum is 2)" << endl;
cout << "?";
cin >> numopt;
} while (numopt < 2);
for (i=0; i < numopt; i++)
{
cout << "Option " << i << "?";
cin >> optiondesc[i];
}
...
return 0;
}
May be I've not allocated spacE?:confused: