Q:

issue using "count++" : the first time, it repeats "0"

I had a little question :
I tried to add a +1 to a NSString. The first time I push the button muButton, it does not add a +1, but repeats the "0" from the beginning. However, the second push and subsequent pushes to muButton does increment properly. Do you know what could fix this? Here's my code :

 - (IBAction)muButton {  
 if(count >= 999) return;  
 NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count++];
result.text = numValue;
[numValue release];

}
- (void)viewDidLoad {  
result.text = @"0";  
[super viewDidLoad];

}

Thanks

A:

if count == 0
then count++ == 0
++count == 1
Thats what happens when you use the ++ before the parameter as opposed to after.
c = 0
1 + (++c) == 2
BUT
1 + (c++) == 1
c == 1 AFTERWARDS in both cases 

When you use a pre-increment the ++ happens immediately as opposed to if you use a post-increment when it happens after the operations on the parameter take place.

A:

int var = count++;

is equal to :
int var = count;
count = count + 1;

maybe you want to use this :
int var = ++count;

is equal to :
count = count + 1;
int var = count;

