链表插入问题
											程序如下:
int list::inser(const int x,const int i)
{    
listnode *p=first;int k=0;
    while(p!=NULL&&k<i-1) 
                      {p=p->link;k++;}
    if(p==NULL&&first!=NULL)     /* 这块我不太明白*p不是等于first的吗那么 if(p==NULL&&first!=NULL)不是矛盾吗?
             {cout<<"invalid position for iosettation! \n";  return 0;}
listnode *newnode=new listnode(x,NULL);
if(first==NULL || i==0){
         newnode->link=first;
         if(first==NULL)
              last=newnode;
              first=newnode;
}
else{
    newnode->link=p->link;
    if(p->link==NULL) last=newnode;
    p->link=newnode;
}
return 1;
}



 
											





 
	    

 
	

 
											