Thanks for the detailed explanation.
Can anyone please tell me why on last line it will be "GB_8->GB_2" instead of "GB_8->GB_3"
Answer will be same in both cases but just wondering if i left something out(gb1.g is GB_3)
In the last line we are using gb2.g = gb1.g;. Where gb1 represents to grab3 so gb1.g would be representing grab2. That is why it will assign the value of grab2. grab3 would not be available for garbage collection reason being it is sill accessable from gb1.
Thanks Salil for the reply.
I still have one question if gb1 is actually representing GARB_3 and therefore gb1.g will be GARB_B2 as explained by you.
Why gb2.g is still referring to GARB_8.Wont it be GARB_7 for same reason?
I am having difficulty understanding this..