new int(10) vs. new int[10] in C++ Options

davegate 133 - 876
@2015-12-23 09:57:53

In C++, it is always confused between the initialization of a pointer to array and a pointer to a single variable, for example:

int *ip = new int(10);

ip points to a single integer initialized with the value 10.

int *ip = new int[10];

ip points to an array of 10 integers. 

 
Users browsing this topic
Guest