Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zipster

Values from Pointers

This topic is 6934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lets say i have:
int x;
int y;
int *p_x; // Pointer to x

x = 10;
p_x = &x;
...........
 
Now lets say i want to assign the value that p_x points to, to y. So i want y to equal whatever x is, through the p_x pointer. I tried:
&y = p_x;
 
but the compiler doesn''t like this . I''ve been thinking about this and whenver i try something new it doesn''t work. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
So that "*" (in this situation) means "the value pointed to by...". OK, I always used it to make pointers, and i know that & means "address of...".

Thx

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!