|
-
Jun 3rd, 2001, 05:50 AM
#1
Thread Starter
Member
What does this sign do?
I've looked in some gamecode and I don't understand what this sign does: test->test2. What does the '->' sign do exactly?
-
Jun 3rd, 2001, 07:25 AM
#2
Monday Morning Lunatic
It's the indirect-access operator. For example:
Code:
struct mystruct {
int y;
int x;
};
mystruct str;
mystruct *ptr = &str; // Get pointer to str
int num = ptr->y;
int snd = str.x;
So, it's basically: pointer->member, and is equivalent to (*ptr).member. It's to make it more readable, because rather than:
(*((*ptr).ptrmember)).member you can use ptr->ptrmember->member.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|