ios - Why objective-c NS_ENUM variable automatically have default value -


i created enum this

typedef ns_enum(nsinteger, permissionstages) {     thepermissionnotdetermine = 0,     thepermissiondenied = 1,     thereminderpermissionallowed = 2, }; 

and create variable this

permissionstages permissionstagevar; 

i have not assign value it, default variable has permissionstages enum first value, in case thepermissionnotdetermine

why behavior?

the line:

permissionstages permissionstagevar; 

is getting default value of 0. similar line:

nsstring *foo; 

resulting in foo having initial value of nil. or

bool abool; 

resulting in abool having initial value of no.

the variables initialized value of "0".

since enum happens have value 0, variable appears initialized thepermissionnotdetermine.


Comments

Popular posts from this blog

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -

ios - Align baselines with characters in large line heights with Text Kit -