您的位置:首页 > 其它

Foundation框架基础 - 常用结构体

2015-08-10 00:28 316 查看
首先回忆一下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};
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: