unexpected end of file found in comment

今天调试程序遇到下面一个错误:

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

相关文章:

你感兴趣的文章:

标签云: