There was a case when not explicitly initilizing a local CGFloat
to 0 would result the variable holding garbage:
-(void)foo
{
CGFloat aFloat;
NSLog(@"float:%f", aFloat);
aFloat = 70;
}
[self foo];
[self foo];
Output:
float:0
float:70
So it really should print 0 both times, but since I didn't explicitly initialize the float to 0, it contained garbage the second time around. My question is, does this apply to objects as well? Is there a difference for local variables between these two options:
1. NSObject *object;
2. NSObject *object = nil;