c 看段代码

[复制链接]
查看11 | 回复4 | 2009-7-1 12:25:18 | 显示全部楼层 |阅读模式
creat_list里面的l->next=&p->id;是什么意思,结点指针指向了结点的成员...... 而且scanf("%d",&n)竟然在creat_list后面,那你creat_list里面用的n是从哪来的.fun函数也有问题.正确代码如下:#include#includeint n;struct student{
int id;
struct student *next;
};typedef struct student node;node *creat_list(node *head){
node *p,*l; ...
回复

使用道具 举报

千问 | 2009-7-1 12:25:18 | 显示全部楼层
初步发现的问题,其他人可以帮忙补充1、node *creat_list(node *head)函数定义,返回值有问题,程序中return head,函数中未赋值,所以和传入地址相同2、l->next=&p->id; 单链表理解有误,l->next应该是下一个成员地址,应该改为l->netx=p+1;3、node *creat_list(nod...
回复

使用道具 举报

千问 | 2009-7-1 12:25:18 | 显示全部楼层
你这个程序编译都不能通过啊……...
回复

使用道具 举报

千问 | 2009-7-1 12:25:18 | 显示全部楼层
学习学习。。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行