Reputation: 8195
I try to multiply two NSIntegers, but Xcode gives me an error:
NSInteger singlePage = ((NSInteger)floor((scrollView.contentOffset.x * 2.0f + pageWidth) / (pageWidth * 2.0f)));
NSInteger page = singlePage * visiblePages;
And the error itself:
Invalid operands to binary expression ('NSInteger' (aka 'int') and 'NSInteger *' (aka 'int *'))
NSInteger visiblePages is already defined and is being passed to a method.
I think that the compiler thinks that the * is a pointer sign and not a multiplication symbol. Is there any other method to multiply two NSIntegers?
Upvotes: 2
Views: 2477
Reputation: 7935
You defined visiblePages
incorrectly.
Replace
NSInteger *visiblePages;
with
NSInteger visiblePages;
Upvotes: 7