|
|
test [i] = answer;
this makes char* test[i] point to a local variable array answer. Whet you wanted to do is copy the characters and not the pointer. Use strcpy, memcpy or std::copy for that. Also, strlen does not count the null char, so you need to allocate strlen(answer)+1 chars instead.