struct_list_sign_my_name.c
来源:互联网 发布:手机淘宝直通车怎么进 编辑:程序博客网 时间:2024/05/16 14:43
#include<stdio.h>
#define null 0;
struct person
{
char name[];
int id;
char adress[];
struct person * next;
struct person * last;
}
//one-direction struct list
struct person * create(int num)
{
int i;
struct person * p,q,head;
head=p=q=(struct person * )malloc(sizeof(struct person));
p->next=p->last=null;
if(num>1)
{
for(i=2;i<=num;i++)//i represents number of crunodes
{
p=(struct person * )malloc(sizeof(struct person));
p->last=q;
q->next=p;
//import the imformation of people
q=p;
}
}
p->next=null;
return head;
}
void finder(struct person * p)
{
if(p->name hasn not been visited)
{
//sign my name
p=p->next;
finder(p);
}
else
{
p=p->last;
//find another person
if (can not find)
exit (0);
}
}
void main()
{
int num;
struct person * head;
printf("Enter the number of person you want to visit:\n");
scanf("%d",&num);
head=create(num);
finder(head);
printf("It's the end!\n Work more tomorrow!\n");
}
- struct_list_sign_my_name.c
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- C
- c
- 编程小程序:1.编写程序,每次程序运行,产生5组双色球号码。每组号码升序排列,至少写出三种排序方法。
- HDU 1969 PIE
- BootStrap 折叠框
- 屏幕适配
- iOS开发微信分享图片32K限制解决方案
- struct_list_sign_my_name.c
- 异地多活架构设计
- BootStrap 轮播插件
- java的锁机制
- win7 c/c++ opencv 开发环境搭建
- [Leetcode]162. Find Peak Element
- 小白android用ndk、jni录音mp3格式
- 超链接确认跳转
- 深入理解javascript异步编程障眼法&&h5 web worker实现多线程