链表实例
#include<stdio.h>#include<alloc.h>
#include<stdlib.h>
struct zc
{
char name;
char email;
int age;
int password;
struct zc*next;
}*ozc,*nzc,*p1,*p2,*head;
main()
{ int i,n=0;
ozc=(struct zc*)malloc(sizeof(struct zc));
printf("please input your name email age password");
scanf("%s%s%d%d",&p1->name,&p1->email,&p1->age,&p1->password);
/*jiance*/
n++;
p1=ozc;
while(nzc->name!=p1->name&&i<n)
{
if(nzc->name==p1->name)
goto zd;
i++;
p1=p1->next;
}
if(nzc->name==p1->name)
zd: printf("name may not use,sorry!");
else
printf("name may use,ok!");
/*insert*/
if(n=1)
head=nzc;
else {p2=p1;
p2=p1->next;
p2=p1;
printf("please input your name email age password");
scanf("%s%s%d%d",&p1->name,&p1->email,&p1->age,&p1->password);
p1=(struct zc*)malloc(sizeof(struct zc));
}
}