#include<stdio.h>
#include<string.h>
//#include<stdilb.h>
struct Test
{
int data;
struct Test *next;
};
void printLink(struct Test *head)
{
struct Test *point;
point = head;
while(point != NULL)
{
printf("%d ",point->data);
point = point->next;
}
putchar('\n');
}
int main()
{
struct Test *head = NULL;
struct Test t1 = {1,NULL};
struct Test t2 = {2,NULL};
struct Test t3 = {3,NULL};
struct Test t4 = {4,NULL};
struct Test t5 = {5,NULL};
struct Test t6 = {6,NULL};
struct Test t7 = {7,NULL};
t1.next = &t2;
t2.next = &t3;
t3.next = &t4;
head = &t1;
printLink(head);
return 0;
}
链表——静态添加和动态遍历
最新推荐文章于 2024-06-11 15:32:47 发布