Hi guys,
In the code below, the new keyword creates 5 integers for a pointer. However, whenever I am outside of the createmem() function, I cannot access this memory-- visual studio says that integers's memory address is 0x00000000). Why is this happening? Is there a good workaround for it?
Thanks!
-Max
Code:#include <iostream> using namespace std; void createmem(int *myints); void createmem(int *myints) { myints = new int[5]; } int main() { int *integers = NULL; createmem(integers); delete[] integers; }



LinkBack URL
About LinkBacks



