mirror of
https://github.com/ViolentAyang/DataStructureC.git
synced 2026-06-14 22:26:34 +08:00
Create 静态链表介绍.c
This commit is contained in:
34
链表/静态链表介绍.c
Normal file
34
链表/静态链表介绍.c
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#define MaxSize 10
|
||||||
|
|
||||||
|
struct Node{
|
||||||
|
int data;
|
||||||
|
int next;
|
||||||
|
};
|
||||||
|
typedef struct{
|
||||||
|
int data;
|
||||||
|
int next;
|
||||||
|
}SLinkList[MaxSize];
|
||||||
|
/*
|
||||||
|
等价于
|
||||||
|
struct Node{
|
||||||
|
int data;
|
||||||
|
int next;
|
||||||
|
};
|
||||||
|
typedef struct NodeSLinkList[MaxSize];
|
||||||
|
*/
|
||||||
|
int main(){
|
||||||
|
//SLinkList a;//等价于 struct Node a[MaxSize];
|
||||||
|
struct Node x;
|
||||||
|
printf("sizeX=%d\n",sizeof(x));
|
||||||
|
|
||||||
|
struct Node a[MaxSize];
|
||||||
|
printf("sizeA=%d\n",sizeof(a));
|
||||||
|
|
||||||
|
SLinkList b;
|
||||||
|
printf("sizeB=%d\n",sizeof(b));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user