Quick actions

cmd+k|ctrl+k

Navigation

Languages

Essential Go / Methods

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:10:15Z

Updated

2019-03-26T10:10:15Z

package main

import "fmt"

type Person struct {
	FirstName string
	LastName  string
}

func (p Person) PrintFullNameValue() {
	fmt.Printf("PrintFullNameValue:   address of p is %p\n", &p)
}

func (p *Person) PrintFullNamePointer() {
	fmt.Printf("PrintFullNamePointer: p is            %p\n", p)
}

func main() {
	p := Person{
		"John",
		"Doe",
	}
	fmt.Printf("address of p:                         %p\n", &p)
	p.PrintFullNamePointer()
	p.PrintFullNameValue()
}
INFO