1
我目前正试图分配一个指向名为totheright(这是一个链表节点)的结构的指针。指向结构/列表的指针当前位于另一个称为矩形的结构内。我尝试这样做时遇到错误。不同结构类型指针指向指针结构指针
currect->right = malloc(sizeof(totheright));
righthead = current->right;
以下是函数的声明:
rect *currect = NULL;
totheright *righthead = NULL;
在报头结构的定义:
typedef struct _totheright {
int rect;
struct _totheright *right;
} totheright;
typedef struct _rect {
int thisrect;
struct totheright *right;
int left;
double width;
double height;
double xcord;
double ycord;
struct _rect *next;
} rect;
'righthead = current-> right;'should be'righthead = currect-> right;' –