|
-
Jun 15th, 2003, 04:26 PM
#1
Thread Starter
Good Ol' Platypus
Just to get some things straight
On my way to learning C++, I have bought SAMS Teach Yourself (21 Days) book... and what excellent value it was. I'm on day 9 now, just finished pointers... One thing's unclear. If I got it right, these two mean the same thing?
Code:
(*pPointer).PublicVar
Code:
pPointer->PublicVar
If so, then I'm on to day nine
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 15th, 2003, 09:17 PM
#2
Frenzied Member
Yes, they are the same thing. Using the arrow is just easier to type =).
Z.
-
Jun 15th, 2003, 10:15 PM
#3
Thread Starter
Good Ol' Platypus
I heard that I finally understand pointers (yippie)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 16th, 2003, 08:55 PM
#4
Frenzied Member
The -> operator means a pointer to a member. Go for day 9
-
Jun 17th, 2003, 05:52 AM
#5
Member
say i had a structure with values in it like name, health
eg
struct person
{
char[10] name;
int health;
}
person Me
Me->name = "johnny"
would that apply aswell?
-
Jun 17th, 2003, 01:06 PM
#6
Fanatic Member
Yes, you can use the -> operator on structs as well, but you can't do what you try to do. You can't assign things to a character array with the = operator, you need to use the strcpy() function...
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
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
|