马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
# include
# include
# include
struct Node
{
int data; //数据域
struct Node * pNext; //指针域
};
//函数声明
struct Node * create_list(void);
void traverse_list(struct Node *);
int main(void)
{
struct Node * pHead = NULL; //等价于 struct Node * pHead = NULL;
pHead = create_list(); //create_list()功能:创建一个非循环单链表,并将该链表的头结点的地址付给pHead
traverse_list(pHead);
return 0;
}
struct Node * create_list(void)
{
int len; //用来存放有效节点的个数
int i;
int val; //用来临时存放用户输入的结点的值
//分配了一个不存放有效数据的头结点
struct Node * pHead = (struct Node *)malloc(sizeof(struct Node));
if (NULL == pHead)
{
printf("分配失败, 程序终止!\n");
exit(-1);
}

在使用Visual Studio 2010编译C语言程序时遇到一系列未声明的标识符错误,如pTail和pNew。错误主要出现在结构体定义、内存分配及链表操作部分。错误提示显示在变量声明和结构体成员访问上,可能由于变量作用域、拼写错误或未正确初始化导致。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



