Could someone explain why I get this?
CGRect rect;
NSLog(@"rect is %@", NSStringFromCGRect(rect));
// rect is {{-1.99891, 2.58159e-38}, {1.91754e-41, 8.46552e-39}}
And what about primitives?
Could someone explain why I get this?
CGRect rect;
NSLog(@"rect is %@", NSStringFromCGRect(rect));
// rect is {{-1.99891, 2.58159e-38}, {1.91754e-41, 8.46552e-39}}
And what about primitives?
Objective-C initializes instance variables to 0. It does not necessarily initialize local variables to 0.
If you have ARC enabled, Objective-C initializes local variables that are object pointers (e.g. NSObject *
, UIView *
, etc.) to nil. But it doesn't initialize any other local variables. Other local variables (and object pointers if ARC is disabled) will have random values unless you explicitly initialize them.