return function pointer getting crushed??
I have a function that produces an array result. I return a pointer to that result. I am finding that the pointer / array looks as expected at a breakpoint right after the function returns but a few lines down the code the array values are getting crushed. I am learning that the stack gets reclaimed and yes this can and will happen. My question is what can I do right after the function returns to claim the array in main and not have it change on me? I would like to not modify the function (ie leave the pointer to the returned array) if possible.
Thanks