这个指向结构中指针的指针是什么意思?

GzA*_*ndy 6 c pointers

所以给了我一个结构:

struct Xxx
{
    struct Yyy{...};
    Yyy **yyys;             // matrix of yyys
};
Run Code Online (Sandbox Code Playgroud)

我很困惑指针指针如何与矩阵相关?

我怎样才能初始化新的Yyy和新的Xxx

dbu*_*ush 3

第一级指针将指向一个指针数组,每个第二级指针将指向一个数组Yyy

它们可以设置如下:

struct Yyy **makeMatrix(int rows, int cols)
{
    int i;
    struct Yyy **result = malloc(rows*sizeof(struct Yyy *));
    for (i = 0; i < rows; i++) {
        result[i] = malloc(cols*sizeof(struct Yyy));
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)