如果我有:
int **p;
为什么我不能这样做?
p = new *int[4];
但如果我有:
class T {...}
T **c;
c = new *T[4];
那是对的吗?
必须在*它修改的类型名称之后:
p = new int*[4];
c = new T*[4];
不,这是不正确的。
*必须在type -name之后。
那么它应该是:
p = new int*[4];
和
c = new T*[4];
You're trying to multiply the keyword new with the type (int or T)! To say you want a new array of pointers to int:
p = new int*[4];
or an array of pointers to T:
c = new T*[4];