#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
struct LinkNode {
int data;
struct LinkNode* next;
};
void printList(struct LinkNode* head) {
while (head->next != NULL) {
head = head->next;
printf("%d\n", head->data);
}
}
void staticList() {
struct LinkNode head;
struct LinkNode b1;
struct LinkNode b2;
struct LinkNode b3;
b1.data = 10;
b2.data = 20;
b3.data = 30;
head.next = &b1;
b1.next = &b2;
b2.next = &b3;
b3.next = NULL;
printList(&head);
}
int main(int argc, char* argv[])
{
staticList();
system("pause");
return EXIT_SUCCESS;
}
C语言-静态链表
最新推荐文章于 2024-10-02 21:02:12 发布