第四问 完成
欢迎测试 寻找bug

程序代码:
void inslist(pdata head,int pos,int value)
{
pdata pfirst=head->next;
int i=0;
while(pfirst!=NULL && pos>0)
{
i++;
if(i==pos) break;
pfirst=pfirst->next;
}
pdata ptmp;
if(pos==0) ptmp=head->next; else ptmp=pfirst->next;
pdata pins=(pdata)malloc(sizeof(tdata));
if(pos==0) head->next=pins;else pfirst->next=pins;
pins->value=value;
pins->next=ptmp;
}
int main(int argc, char* argv[])
{
pdata head;
head=linkcre();
prnlist(head);
inslist(head,0,56); //测试头部插入
prnlist(head);
inslist(head,5,777); //测试中间插入
prnlist(head);
inslist(head,8,99999); //测试尾部插入
prnlist(head);
printf("请输入待查找的序号:");
int pos=0;
scanf("%d",&pos);
searchlistp(head,pos);
printf("请输入待查找的值:");
int value=0;
scanf("%d",&value);
searchlistv(head,value);
return 0;
}