Found a strange issue. Default value of BOOL is returning TRUE for iOS 10 [closed]

It’s not a default value as you might think. The reason is that local variables are not initialized unlike instance variables (by default objects are nil, integers are 0, etc).

When you define a local variable, it contains garbage. It means that you can’t use a local variable until you initialize it with some value.

- (void) someMethod {
    Bool b; //garbage YES or NO
    NSInteger i; //garbage like 113242151235
    NSString *s; //garbage pointer

Browse More Popular Posts

Leave a Comment