I am starting again with c++ and was thinking about the scope of variables. If I have a variable inside a function and then I return that variable will the variable not be ‘dead’ when it’s returned because the scope it was in has ended?
I have tried this with a function returning a string and it did work. Can anyone explain this? Or at least point me to some place that can explain this to me please.
Thanks
The stack and the heap