I am puzzled how both new int and new int[n] return an int*. Why doesn't the latter return an int**?
Here is some context: refer to the variable data below in a snippet from Goodrich, Tamassia, and Mount's 2nd ed. Data Structures and Algs in C++ textbook:
class Vect {
public:
Vect(int n);
~Vect();
// ... other public members omitted
private:
int* data;
int size;
};
Vect::Vect(int n) {
size = n;
data = new int[n];
}
Vect::~Vect() {
delete [] data;
}