It allocates one object of type int
and initialized it to value 100
.
A lot of people doesn't know that you can pass an initializer to new
, there's a particular idiom that should be made more widely known so as to avoid using memset
:
new int[100]();
This will allocate an array of int
and zero-initialize its elements.
Also, you shouldn't be using an array version of new
. Ever. There's std::vector
for that purpose.