• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

用C语言把两个单链表合成一个新链表,代码写到一半写不下去,求帮忙?

#include "stdio.h"
#include "stdlib.h"
#define LIST_INIT_SIZE 100
#define OVERFLOW -2
#define  ERROR 0
#define OK  1
#define LISTINCREMENT 10
typedef int ElemType;
typedef int Status;

typedef struct sqlist
{   ElemType*elem;
int listlength;
int listsize;
}SqList;
Status InitList_Sq(SqList*L)
{  L->elem=(ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElemType));
   if(!L->elem)  exit(OVERFLOW);
   L->listlength=0;
   L->listsize=LIST_INIT_SIZE;
   return OK;
}
int Listlength (SqList*L)
{   return L->listlength;

};
int GetElem(SqList*L,int i,ElemType e)
{   
if(0elem[i-1];
else
return  ERROR;
}
Status ListInsert_Sq(SqList*L,int i ,ElemType e)
{     
ElemType *newbase,*p,*q;
if(iL->listlength+1) return ERROR;
if(L->listlength>=L->listsize)
{  newbase = (ElemType *)realloc(L->elem,(L->listsize+LISTINCREMENT) * sizeof (ElemType));
  if(!newbase) exit(OVERFLOW);
  L->elem=newbase;
  L->listsize=L->listsize+LISTINCREMENT;
}
q=&(L->elem[i-1]);
for(p=&(L->elem[L->listlength-1]);p>=q;--p)
*(p+1)=*p;
L->elem[i-1]=e;
++L->listlength;
return OK;
}
void MergeList(SqList La,SqList Lb,SqList*Lc)
{  
ElemType i,j,k,La_len,Lb_len,ai,bj;
InitList(Lc);

i=j=1;k=0;
La_len=ListLength(La);Lb_len=ListLength(Lb);
while((i

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!