标签:注释带来的问题
今天调试程序遇到下面一个错误:
unexpected end of file found in comment
#include"List.h" void InitList(List *list) { Node *s = (Node *)malloc(sizeof(Node)); assert(s != NULL); s->next = NULL; list->first = list->last = s; list->size = 0; } /*尾插法:开辟并初始化--->>连接---->>指针后移*/ bool push_back(List *list,ElemType x) { Node *s = (Node *)malloc(sizeof(Node));//开辟一个结点 if(s == NULL) { return false; } s->next = NULL;//对节点的初始化 s->data = x; list->last->next = s;//连接 list->last = s; //后移(尾指针后移) list->size++; return true; } void show_seqlist(List *list) { Node *p = list->first->next; while(p != NULL) { printf("%d\n",p->data); p = p->next; } } /*头插法:开辟并初始化--->>连接---->>指针后移 !!**注意特殊情况**!!*/ bool push_front(List *list,ElemType x) { Node *s = (Node *)malloc(sizeof(Node)); if(s == NULL) { return false; } s->data = x; s->next = list->first->next; list->first->next = s; //注意:如果是第一个结点,则尾指针需要改变指向即指向第一个结点 //(不再指向头)如果不是第一个结点,尾指针指向无需改变 if(list->size == 0) { list->last = s; } list->size++; return true; }
致命错误!!!
百般思索才找到问题的原因所在:
/*头插法:开辟并初始化--->>连接---->>指针后移 !!**注意特殊情况**!!*/
该为下列代码即可
//头插法:开辟并初始化--->>连接---->>指针后移 !!**注意特殊情况**!!
omg愿不再犯
unexpected end of file found in comment
标签:注释带来的问题
原文地址:http://blog.csdn.net/zongyinhu/article/details/45341557