March 12th, 2002, 06:30 AM
Join Date: Mar 2002
Time spent in forums: < 1 sec
Reputation Power: 0
return addr of an struct-array
Why doesn't this give the expected result:
/* start cpp-code */
option *getOption(char *chrOption, int intMaxOption)
myOption = new option[intMaxOption];
//code to fill myOption with elements
int main(int argc, char* argv)
myOption = getOption(test, 5);
//all values in myOption gives the same as the
//last filled value in myOption.
//ex. myOption.option2 will give the same as
//myOption.value, even if they have different
//values in the getOption function...
/* end cpp-code */
Yes, I know this could be done easier with classes in C++,
but would like to have a solusion to this problem.