Objective-C 中 BOOL 类型属性的缺省值是多少?
高洛峰
高洛峰 2017-04-28 09:06:24
0
4
762

Objective-C 中 BOOL 类型的属性未初始化,那么它的值是默认YES/NO,还是随机的?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(4)
黄舟

The default is NO.

刘奇

The default value of basic data types in OC is 0, and the type 0 of BOOL represents NO

洪涛

The BOOL type is a typedefed char type. When not initialized, it is the same as the C language, which is 0 in ASCII, and the same as 0000 in Unicode

仅有的幸福

Member variables have default values:

Variables Default value
Byte 0
short 0
int 0
long 0L
char /u0000'
float 0.0F
double 0.0D
Boolean FALSE
All pointer variables nil (is the null pointer)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template