【发布时间】:2014-11-30 03:20:34
【问题描述】:
如果我有以下结构:
struct myStruct {
int value;
struct myStruct *next;
};
并且有一个实例被定义为
struct myStruct *the_struct = (void *) malloc(sizeof(struct myStruct))
如何访问 *next 的“值”?
我试过做
the_struct->next.value
和
*(the_struct->next)->value
但我收到错误“取消引用指向不完整类型的指针”。
【问题讨论】:
-
第二个
(*the_struct->next).value有效。