— Imagine a, b are int. b is copy of a. Here you have same situation
— Doesn't a have the same address as b despite b doesn't exist anymore?
— Thing is, if oarameter is a pointer, it isn't always pass-by-reference
— Ofc not. They are different variables
They are at two different memory addresses. In my case, it's the same memory addres that a and b are pointing to
— Only before call. When b is changed, they point to different addresses
— How has b changed? It still points to the start of the memory block ..right?
— B = ...b changed
— A didn't
— Which line number has b changed in?
— The malloc one
— But I did a gdb..and just before foo exits, b holds the same address which it held at the beginning of foo
Message permanent page
— Points to or has?
— Just before