标签:
C语言实现
#include <stdio.h>
#include <malloc.h>
typedef struct node{
int data;
struct node*next;
}ElemSN;
ElemSN * deleteLink(ElemSN*h){
printf("nihao");
ElemSN * p;
for(p=h;h;){
printf("%d ",h->data);
h=h->next;
free(p);
}
return h;
}
int main(void){
int a[5]={10,20,30,40,50};
int i;
ElemSN*p,*h,*t;
for(i=0;i<5;i++){
p=(ElemSN*)malloc(sizeof(ElemSN));
p->data=a[i];
p->next=NULL;
if(!i) h=t=p;
else t=t->next=p;
}
h=deleteLink(h);
if(!h){
printf("已删除~!");
}else{
printf("未删除!");
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/JaneSJ/p/Jane.html