list stack.docVIP

  • 1
  • 0
  • 约4.05万字
  • 约 7页
  • 2016-12-25 发布于河南
  • 举报
struct Node{ int info; struct Node* next; }node; int length(node *head) { int len=0; node *p=head; while(p) { len++; p=p-next; } return len; } int delete(node *head,int loc) { node *p,*pre; int i=0,num=0 if(head == null) return; if(loclen||loc0) printf(error); pre=head; p=pre-next; while(i!=loc) { i++; pre=p; p=p-next; } num=p-info; pre-next=p-next; p-next=null; free(p); return num; } int insert(node *head,int loc,int num) { node *p,pre,*s; int i=0; if(head==null) return; if(loclen||loc0) return -1; pre=head; p=head-next; while(i!=loc) { i++; pre=

文档评论(0)

1亿VIP精品文档

相关文档