Welcome to the Treehouse Community
Looking to learn something new?
why is ball a pointer (*ball)? Is it not possible to just use a variable ball?
ball is declared as *ball. Does this mean it is a pointer? When are pointers used and when are normal variables used?
Andrew Boryk15,916 Points
Points are used to send the value of variable to an address in memory. The reason why you must have a point on Ball is because Ball is an Object, and all objects need to have a reference point in memory. Primitive data types don't require pointers, however you may use them. Objective-C is an object oriented language, so even Strings (which in other languages wouldn't be objects), are actually objects and are declared with NSString *string. Hope I helped, been programming in Objective-C for a little over two years. I could be off a bit, but that is what I've always told myself.
Michael Hulet47,842 Points
It's been a while since I've done iOS development (I haven't actually taken the Treehouse track, but I've done a very little in the past), but I think all objects in Objective-C are pointed to, and I think it has to do with the fact that they have setter and getter methods that you can modify, and those actually store the variable