OC 结构体的应用
发布日期:2021-06-30 22:37:10 浏览次数:3 分类:技术文章

本文共 688 字,大约阅读时间需要 2 分钟。

#import 
typedef struct{ int year; int month; int day;}MyDate;@interface Student:NSObject{
@public NSString *_name; MyDate _date;}@end@implementation Student@endint main(int argc, const char * argv[]){ @autoreleasepool { Student *stu = [Student new]; stu ->_name = @"tom"; stu ->_date = (MyDate){
2012,12,22}; MyDate d = {
2222,11,11}; stu ->_date = d; NSLog(@"year = %d,month = %d, day = %d", stu->_date.year, stu->_date.month, stu->_date.day); struct Car{ int _wheel; int _speed; }car; car = (struct Car){
22,22}; NSLog(@"Hello, World!"); } return 0;}

转载地址:https://lovoo.blog.csdn.net/article/details/51464418 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:jquery判断字符串中是否存在某个的字符串
下一篇:Android 获取dip数据的三种途径

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年05月01日 04时04分36秒