Message from C, C++ talks

July 2019

— And after?

— So it has or points to are same

— After foo exits, b is gone..but the address is still valid in the heap

— B is destroyed and a will never be changed to b's value


Yes b is destroyed. but what matters is the address that is still valid because the heap has not released the memory

— But you didn't save this address

— Right

— Do I really need to? If I know the address(which is same throughout the program) why is there a need to save it

Message permanent page

— Wtf

— A needs to know the address, not you

— Wtf. Right after the call you lost this address. You don't know it. It's gone

— Of cors, a has the address (which is same throughout the program).
I am sorry if I am not able to explain my point well

Message permanent page

— But if it doesn't work....

— You can't get it outside, cause only b holds it

— And b is gone