convert a reference variable into a pointer variable

You can’t declare a variable as a pointer to a reference, but we often take the address of a reference variable. I think it’s same as address of the referent.

Q: If you need to pass a pointer to a 3rd party library, but you only received a reference variable — perhaps as an function input argument, how?
A: Well, you can treat the variable as a non-ref and simply pass its address to the library.

 

Advertisements

One thought on “convert a reference variable into a pointer variable

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s