learner
learner

Reputation: 11780

I can't seem to divide NSUInteger by 2

The snippet of code:

NSUInteger *lengthOfLine =100;
NSUInteger *half = lengthOfLine/2;

The compile error for line 2:

Invalid operands to binary expression ('NSUInteger *' (aka 'unsigned long *') and 'int')

Upvotes: 0

Views: 83

Answers (1)

Andrey Chernukha
Andrey Chernukha

Reputation: 21808

you should use NSUInteger, not NSUInteger *. NSUInteger is a primitive type, not a subclass of NSObject. Now you're dealing with a pointer to NSUInteger

Upvotes: 1

Related Questions