Why don't I declare NSInteger with a *

前端 未结 5 1025
孤城傲影
孤城傲影 2020-12-08 06:34

I\'m trying my hand at the iPhone course from Stanford on iTunes U and I\'m a bit confused about pointers. In the first assignment, I tried doing something like this

5条回答
  •  无人及你
    2020-12-08 07:04

    The * means “pointer”. The object variable holds a pointer to an object, so it has a *; the NSInteger variable holds an NSInteger, not a pointer to an NSInteger, so it does not have a *. Putting the * on that variable gives you at least a warning because you're putting an integer into a pointer variable.

提交回复
热议问题