Pointers and functions
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
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement