枚举

枚举只能是 int
枚举量可以指定量

1
2
3
4
5
6
enmu color{
red,
yellow,
blue,
green,
};

结构

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
struct date{
int year;
int month;
int day;
};

//初始化
struct date today;
today.year = 2019;
today.month = 8;
today.day = 23;

//初始化
struct date today = {2019, 8, 23};

//初始化
struct date t_day = {.month = 8, .year = 2019};
  • 无名结构
1
2
3
4
5
6
//(date) 可选
struct (date){
int year;
int month;
int day;
}today,yesterday;
*结构参数是值的传递*

结构指针

1
2
(*p).month = 12;
p->month = 12;

结构数组

1
2
3
4
5
6
7
8
struct time{
int hour;
int minutes;
int seconds;
};
struct time times[] = {
{12,20,25},{16,24,45}
};

结构的嵌套

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
struct date{
int year;
int month;
int day;
};
struct time{
int hour;
int minutes;
int seconds;
};
struct DayAndTime{
struct date today;
struct time currtime;
};
struct DayAndTime dayAndtimes[] = {
{{2019,8,25},{16,24,45}},
{{2019,8,23},{13,14,35}}
};

typedef

声明一个已经有的数据类型的新名字

1
2
3
4
5
6
7
8
9
typedef long int64_t;
typedef struct time{
int hour;
int minutes;
int seconds;
} CurrTime;

int64_t i = 1000000000000;
CurrTime t = {12,35,24};

联合

成员使用同一个内存空间

1
2
3
4
typedef union{
int i;
char ch[sizeof(int)];
} CHI;

ACLLib 图形库

Win32API的函数库,开发Windows程序

ACLLib