【发布时间】:2012-03-26 09:04:18
【问题描述】:
当我尝试打印此列表时遇到的错误是不兼容的类型错误。我尝试将其转换为结构宏、静态结构宏、指针,但都不起作用。
struct macro {
struct macro *next;
char * macro_name;
char * macro_body;
};
static struct macro macro_list = {
.next = NULL,
.macro_name = NULL,
.macro_body = NULL
};
//--------------------------------------------------------------------------------
void macro_list_print(void){
printf("Printing macro_list\n");
if(macro_list.next == NULL){
printf("--No macros\n");
}
struct macro p = macro_list;
while(p.next != NULL){
printf("%s %s\n",p.macro_name,p.macro_body);
p = macro_list.next; //This line gives me the error.
}
}
我不知道在这里做什么。任何帮助都会被占用,谢谢。
【问题讨论】:
-
请包括您收到的错误。
标签: c types variable-assignment incompatibility