Jump to content
  • Advertisement

Archived

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

guyaton

Pointers and functions

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

What I am trying to do is send a pointer in a function, and inside that function create that pointer of some size (which can only be determined inside the function) and then store information to that pointer. When I exit the function I want to be able to access/use that information. How do I do that? ~Guyaton

Share this post


Link to post
Share on other sites
Advertisement
I''ll just butt in and recommend the latter form:
function_name( data_type*& ptr)
because it forces the pointer itself to be a valid variable (though it does not necessarily point to something valid!). If you use data_type**, it''ll force you to do another NULL check.

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.

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!