#include <stdio.h>
typedef struct Teacher
{
int data;
struct Teacher *next;
}Teacher;
Teacher *CreatlIST()
{
static Teacher t1, t2, t3;
Teacher *p = NULL;
t1.data = 1;
t2.data = 2;
t3.data = 3;
t1.next = &t2;
t2.next = &t3;
t3.next = NULL;
p = &t1;
while (p)
{
printf("data:%d \n", p->data);
p = p->next; //指针的下移
}
return &t1;
}
int main(void)
{
Teacher * head = CreatlIST();
return 0;
}
静态链表使用
最新推荐文章于 2024-07-24 21:34:55 发布