I have an if statement like this
@property (nonatomic) NSUInteger *theScore;
if (hint.hidden) {
theScore += (2);
} else {
theScore += (1);
}
NSLog(@"Score changed");
score.text = [NSString stringWithFormat:@"%d", theScore];
But instead of theScore increasing by 2 or 1 it’s increasing by 8 or 4
Any ideas?
Because it’s a pointer to the integer, not the integer itself. The 4 is the SIZE of the integer.
Change it to NSUInteger theScore, without the *.