Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Can two new objects point to the same memory address in GoLang?

Do you have any idea what the output will be for below GoLang snippet?package mainimport ( "fmt")type obj struct{}func main() { a := &obj{} fmt.Printf("%p\n", a) c := &obj{} fmt.Printf("%p\n", c) fmt.Println(a == c)}Many people would think that a and c are two different object instances which have different memory addresses. Hence a == c will be false. But if you try to run the above program, you would see below output0x5781c80x5781c8trueTo get to know the reason why the comparison returns true, some understanding of how Go allocates memory and how variable memory escape happens are ne...

12,274 0       ZEROBASE VARIABLE ESCAPE GOLANG GO