使用空指针初始化
char*** p = 0; //or NULL, or nullptr
Run Code Online (Sandbox Code Playgroud)
另外一个选项
char x;
char *y = &x;
char **z = &y;
char ***p = &z;
Run Code Online (Sandbox Code Playgroud)
分配记忆?
char *** p = new char**[dim1];
for(int i = 0; i < dim1; ++i)
{
p[i] = new char*[dim2];
for(int j = 0; j < dim2; ++j)
{
p[i][j] = new char[dim3];
}
}
Run Code Online (Sandbox Code Playgroud)