将AB存放在线性表中输出.docVIP

  • 3
  • 0
  • 约 6页
  • 2016-12-25 发布于河南
  • 举报
创建单链表A和B,将AB存放在线性表中按从小到大输出 #include stdio.h #include stdlib.h typedef struct node { int data; node* next; }node; node *InLink() { int x; node *p,*q,*head; q=(node*)malloc(sizeof(node)); q-next=NULL; head=q; p=q; scanf(%d,x); while(x!=0) { q=(node*)malloc(sizeof(node)); q-data=x; q-next=NULL; p-next=q; p=q; scanf(%d,x); } return head; } /*创建单链表*/ void nizhi(node *head1,node *head2) {int b[100],i,j,m,n; node *p,*q; p=head1-next; for(i=0;p!=NULL;i++) {b[i]=p-data; p=p-next; } q=head2-next; for( ;q!=NULL;i++) {b[i]=q-data; q=q-next; } for(n=1;n

文档评论(0)

1亿VIP精品文档

相关文档