我尝试打印出此列表时出现的错误是不兼容的类型错误。我试图将它转换为结构宏,静态结构宏,一个指针,而不是它的工作。尝试分配不兼容类型时出错
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.
}
}
我不知道该怎么办。任何帮助将被拨出谢谢。
请附上您收到的错误。 – 2012-03-08 21:27:38