结构体的嵌套
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 //链表嵌套实现继承,描述复杂的事物属性,C数据结构都是结构体,
5 struct other
6 {
7 int canmove;
8 };
9
10 struct animal
11 {
12 struct other other1;
13 int canrun;
14 };
15
16 struct people
17 {
18 struct animal animal1;
19 int think;
20 };
21
22 struct tiger
23 {
24 struct animal animal1;
25 int tooth;
26 int ishair;
27 };
28
29 struct listnode
30 {
31 int num;
32 struct listnode *pleftlist;
33 struct listnode *rightlist;
34 };
35
36 struct file
37 {
38 int size;
39 int isbin;
40 int isexe;
41 int time;
42 };
43 struct filesnode
44 {
45 struct file *pfile;//多个文件
46 int pfiles;
47 struct filesnode *filesnode;//多个文件夹
48 int ppfiles;
49 };
50
51 struct array
52 {
53 int *p;
54 int length;
55 };
长风破浪会有时,直挂云帆济沧海
posted on 2015-05-17 16:05 Dragon-wuxl 阅读(222) 评论(0) 收藏 举报
浙公网安备 33010602011771号