I am really confused with the code,my question is why I am getting value of the variables after releasing.
NSNumber *a=[[NSNumber alloc]initWithInt:2];
NSNumber *b=[[NSNumber alloc]initWithInt:3];
b=a;
[a release];
[b release];
NSLog(@"a=%@",a);
NSLog(@"b=%@",b);
OUTPUT: a=2 b=2
when I am allocating the veriables retain count increments by 1,I have no other code where retain count increments.So my question is after release message retain count will be 0 and the objects will be deallocated and I should not get the value. ////////////////////////////////////////////////////////////////// Hi all I found an answer but the logic behind it is not clear to me,If I put "I" after the integer number it gives the desired output.Will you please help.
NSNumber *a=[[NSNumber alloc]initWithInt:2I];
NSNumber *b=[[NSNumber alloc]initWithInt:3I];
b=a;
[a release];
[b release];
NSLog(@"a=%@",a);
NSLog(@"b=%@",b);
OUTPUT: a=0 b=0