首页 > 其他分享 >OC之【enum枚举】

OC之【enum枚举】

时间:2022-12-09 15:02:29浏览次数:31  
标签:summer winter spring enum OC 枚举 Season 定义

void
// 定义一种枚举类型
enum

// 定义一个枚举变量s
enum Season s = winter;
}

void
// 定义枚举类型的同时定义一个枚举变量s
enum Season {spring, summer, autumn, winter} s = spring;
}

void
enum {spring = 3, summer, autumn, winter} s = winter;

printf("%d", s);
}

标签:summer,winter,spring,enum,OC,枚举,Season,定义
From: https://blog.51cto.com/u_15907570/5925319

相关文章

  • OC之【NSDate使用】
    #import<Foundation/Foundation.h>日期创建void//date方法返回的就是当前时间(now)NSDate*date=[NSDatedate];//now:21:09:40//date:21:09:50......
  • OC之【内存管理】
    Student@synthesizeage=_age;//在xcode4.5以上环境下可以省略-(void)dealloc{@"%@被销毁了",self);super//一定要调用super的dealloc方法,而且最好放在最......
  • OC之【NSObject使用】
    main.m文件#import<Foundation/Foundation.h>#import"Student.h"#import"Person.h"常用方法voidStudent*stu=[[[Studentalloc]init]autorelease];//isKin......
  • OC之【@property的用法】
    1.这里的retain代表:在set方法中,release旧值,retain新值(nonatomic,retain)Book*book;(retain)Card*card;代表只生成get方法的声明默认是readwrite,同时生成get和set......
  • OC之【objective-c中结构体】
    #import<Foundation/Foundation.h>void//定义了Date这种结构体类型structintintint};//定义结构体变量structDated={2013,4,5};day=6;}voi......
  • C# OpenProtocol 开放以太网协议 读写数据 订阅数据
    主要使用的软件是HslCommunication关于这个软件的本身,详细可以参考下面的地址:github地址:https://github.com/dathlin/HslCommunication官网:http://www.hslcommunicatio......
  • 枚举进阶使用
    ##......
  • Docker-Compose常用命令
    一、Docker-Compose简介  Docker-Compose项目是Docker官方的开源项目,负责实现对Docker容器集群的快速编排。  Docker-Compose将所管理的容器分为三层,分别是工程(projec......
  • 论文阅读:Zeno: Distributed Stochastic Gradient Descent with Suspicion-based Fault
    论文链接:http://proceedings.mlr.press/v97/xie19b/xie19b.pdf基于怀疑容错的分布式SGDAbstactzeno优势在于只需要假设系统中存在一个正常节点。核心思想:怀疑有潜在缺......
  • git报错:cannot lock ref ***;unable to resolve reference *** reference brenkon
    git报错:cannotlockref***;unabletoresolvereference***referencebrenkon把本地修改stash下,执行完在pop取出:https://blog.csdn.net/weixin_42168046/article/det......