Welcome To Golang By Example

Default Zero Value of Pointer in Go (Golang)

Table of Contents

Overview

Default zero value of a pointer is nil. Let’s see a program for it

Program

package main

import "fmt"

func main() {
    var a *int
    fmt.Print("Default Zero Value of a pointer: ")
    fmt.Println(a)
}

Output:

Default value of pointer: