Jump to content
  • Advertisement
Sign in to follow this  
Shadowwoelf

Pointers

This topic is 3719 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

I was just wondering how do you read things like **variable; etc. Or like *(int*) variable; I get confused with all those asterisks or even the *& variable; -note- Some of the examples might not be right

Share this post


Link to post
Share on other sites
Advertisement
A couple of examples:

int* pInt;

Pointer to an integer.

int** ppInt;

Pointer to a pointer to an integer.

void foo( int*& pInt );

pInt is a reference to a pointer to an integer.

Dereferencing ppInt will get you a pointer to an integer:

int* pInt( *ppInt );

Does that clear things up?

Share this post


Link to post
Share on other sites
The short answer (this is given in the context of const-correctness, but it also generally applies to sorting out the * and & symbols - although you'll also need to understand the syntax for function pointers and member function pointers at some point): backwards.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!