码迷,mamicode.com
首页 > 其他好文 > 详细

unexpected end of file found in comment

时间:2015-04-28 21:02:31      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:注释带来的问题

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

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!