这个C代码哪有问题 创建链表的

[复制链接]
查看11 | 回复0 | 2010-3-20 18:56:43 | 显示全部楼层 |阅读模式
// - -~~~~malloc是要+#include 的哦?你忘记+了。// 代码#include#include #define NULL 0#define TYPE struct stu#define LEN sizeof(struct stu)TYPE{ char name[20]; char gender; int num; int score; TYPE *next;};void main(){ TYPE *creat(int n); int n; TYPE *p; scanf("%d",&n); p=creat(n);}TYPE *creat(int n){ int i; TYPE *head,*tail,*q; head=tail=NULL; for(i=0;iname,&q->gender,&q->num,&q->score);q->next=NULL;if(head==NULL) head=tail=q;else {tail->next=q;tail=q;} } return head;}
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行