Reputation: 2910
Well, I'm sorry I can't find any useful results when I search "->" on Google, and this is the first time I've seen anything like this. I've found the following line in one of Ray Wenderlich's game center tutorials:
Message *message = (Message *)[data bytes];
if (message->messageType == kMessageTypeRandomNumber) {
...
}
Message here is a predefined struct:
typedef struct {
MessageType messageType;
} Message;
Upvotes: 0
Views: 68
Reputation: 2646
This means the same thing as it does in C and C++, basically you are accessing the data of a pointer.
If you were using an object: you might say message.messageType
Since you are dealing with a pointer: you use message->messageType
to get the messageType data from the pointer message
This syntax saves you from having to dereference a variable before you access its data.
Here is a link to another StackOverFlow question which was asked from a programmer learning C. The same content/principles apply here. Arrow Operator
Here is another link explaining the Difference Between . and ->
Upvotes: 3