Message from C, C++ talks

July 2019

— A didn't

— Which line number has b changed in?

— The malloc one

— 7

— 

But I did a gdb..and just before foo exits, b holds the same address which it held at the beginning of foo

— Points to or has?

— Just before

— I did print b

— 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

Message permanent page

— But you didn't save this address

— Right