int *p = 0; int **x = &p; *x = new int[2]; *x[0] = 1; //p[0] = 1 *x[1] = 2; //p[1] = 2
为什么它会因访问冲突错误而失败?
why does it fails with access violation error?
[]优先于*.您需要先取消引用x
(*x)[0] = 1; (*x)[1] = 1;