Is new int[10]() valid c++?
- by Naveen
While trying to answer this question I found that the code int* p = new int[10](); compiles fine with VC9 compiler and initializes the integers to 0. So my questions are:
First of all is this valid C++ or is
it a microsoft extension?
Is it guaranteed to initialize all
the elements of the array?
Also, is there any difference if I
do new int; or new int();? Does
the latter guarantee to initialize
the variable?