请教各位大虾我的C程序哪里有错!急!!!
来源:互联网 发布:5g网络是什么意思 编辑:程序博客网 时间:2024/05/08 11:25
#include"stdio.h"
#include"math.h"
typedef struct linknode
{
int data;
struct linknode *next;
}node;
node *create(A)
node *A;
{
node *r,*s,*p;
A=s=(node *)malloc(sizeof(node));
scanf("%d",&s->data);
r=s;
while(s->data!=0)
{
r->next=s;
r=s;
s=(node *)malloc(sizeof(node));
scanf("%d",&s->data);
}
p=A;
A=A->next;
r->next=NULL;
free p;
do{
printf("%d->",A->data);
A=A->next;
}while(A!=0);
return A;
}
node *create(B)
node *B;
{
node *r,*s,*p;
B=s=(node *)malloc(sizeof(node));
scanf("%d",&s->data);
r=s;
while(s->data!=0)
{
r->next=s;
r=s;
s=(node *)malloc(sizeof(node));
scanf("%d",&s->data);
}
p=B;
B=B->next;
r->next=NULL;
free p;
do{
printf("%d->",B->data);
B=B->next;
}while(B!=0);
return B;
}
node *sum(a,b)
node *a,*b;
{
node *r,*p,*s;
c=(node *)malloc(sizeof(node));
r=c;
while(a!=0)
{
r->data=a->data;
a=a->next;
p=(node *)malloc(sizeof(node));
r->next=p;
r=p;
}
while(b!=0)
{
p=(node *)malloc(sizeof(node));
r->next=p;
r=p;
r->data=b->data;
b=b->next;
}
r->next=NULL;
free r;
free p;
return c;
}
main()
{
node *k,*i,*j,*A,*B;
i=node *create(A);
j=node *create(B);
k=node *sum(i,j);
do{
printf"%d->",k->data);
k=k->next;
}while(k!=0);
}
目的是先建立两个链表,然后把它们合并在一起,相同的不删除
- 请教各位大虾我的C程序哪里有错!急!!!
- 请教各位高手,程序哪里有错误,用指针表示结构成员是否有错
- C#IO问题请教各位大虾
- 请教各位大虾JB的一个问题?
- 各位大虾帮个忙。急!急!急!
- 新手上路~请教各位大虾~~~请教~请教~
- 请教各位高手,急!
- 有关TrueDBGrid的问题向各位大虾请教
- 请教各位大虾一个网络聊天室的错误!
- 有个关于DetailsView的问题请教各位大虾
- 向各位大侠请教一个c++图形方面的问题,急!!!
- 我需要各位大虾的帮助
- 急急急!!!!请教各位!!1
- 各位大虾,帮忙看一下呀,我的这个有没有错保存不了??第二面附上请求的ASP代码
- 急急急,请各位大虾帮帮忙!
- 请各位大虾进来解决下~!急
- 哪里有网站程序的大虾啊
- 哪里有网站程序的大虾啊
- 应用总结:ASP编程心得回放
- 创建DataGrid并响应了CheckBox事件
- Mantis中文问题的解决办法
- 把木梳卖给和尚
- Inside-springframework-AOP-creator
- 请教各位大虾我的C程序哪里有错!急!!!
- Asp无组件生成缩略图
- Inside-springframework-AOP-invoke
- java面试题答案
- Inside-springframework-Loader-registerBeanPostProcessors
- 软件测试内容全貌——全景图 (1)
- Inside-springframework-bean-definition
- 用文本+ASP打造新闻发布系统
- Inside-springframework-XmlWebApplicationContext