- 4
- 0
- 约1.51千字
- 约 3页
- 2018-06-27 发布于河南
- 举报
C语言非降序插入
#includestdio.h
#includemalloc.h
#define NULL 0
#define LEN sizeof(struct node)
struct node
{
int info;
struct node*link;
};
struct linklist
{
struct node*head;
int n;
};
void main()
{
int i;
int a[4]={3,5,8,10};
int b[6]={2,6,8,9,11,20};
struct linklist La,Lb,Lc;
struct node*p,*q,*pa,*pb,*pc;
La.head=(struct node*)malloc(LEN);
Lb.head=(struct node*)malloc(LEN);
Lc.head=(struct node*)malloc(LEN);
Lc.n=0;
p=La.head;
for(i=0;i=3;i++)
{
q=(struct node*)malloc(LEN);
q-info=a[i];p-link=q;p=q;
}
p-link=NULL;La.n=4;
p=Lb.head;
for(i=0;i=5;i++)
{
q=(struct node*)malloc(LEN);
原创力文档

文档评论(0)