Foundation框架基础 - 常用结构体

it2022-05-09  26

首先回忆一下C中的结构体的使用:

void test() { //定义Date这种结构体类型 struct Date { int year; int month; int day; }; //定义结构体变量 struct Date d = {2015,6,2}; d.day = 5; } void test2() { //通过 typedf 来更加简便的定义结构体 typedef struct Date { int year; int month; int day; } MyDate; MyDate d = {2015,6,2}; }

 

转载于:https://www.cnblogs.com/why-not/p/4716790.html


最新回复(0)