returning pointers from a function
If I use dynamic allocation to create node in a binary tree within a function, will these pointers exisist outside of the function.
I was warned not to return pointers to temporary variables from a function so it seems there are three options. Pass the pointer as an argument to the function and return it after manipulation, use a global pointer (bad idea I understand), or I think use dynamic memory allocation and delete the pointers in another function.
Are these all of the options for returning of type pointer or pointer to functions?
Not dealing with classes yet just a simple struct, and functions.