I have a question about the new operator to allocate array in c++:
int * foo;
foo = new int [5];
in this case, the foo point to a array of int, but how about change the code to:
foo = new int [0];
what is allocated and what will happen?
I have a question about the new operator to allocate array in c++:
int * foo;
foo = new int [5];
in this case, the foo point to a array of int, but how about change the code to:
foo = new int [0];
what is allocated and what will happen?
Nothing is allocated, and using that pointer will invoke undefined behavior.