I created 2 Vertex objects below- q & q.
Now, when I print the pointer variable q = &Vertex, I expected it to be the memory address, why is it printing the - &{1,2}
Output:
{1 2} &{1 2}
Program:
package main
import "fmt"
type Vertex struct {
X, Y int
}
var (
p = Vertex{1, 2} // has type Vertex
q = &Vertex{1, 2} // has type *Vertex
)
func main() {
fmt.Println(p, q)
}