title: Set an int pointer to an int value in Go
body: <p>I'm very new to Go and am trying to set a <code>*int</code> to point to a number, say <code>12345</code>.</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;reflect&quot;
  )
  
  func main() {
      var guess *int
      fmt.Println(reflect.TypeOf(guess))
      *guess = 12345
      fmt.Println(guess)
  }
  </code></pre>
  <p>But it's giving me the following error:</p>
  <pre><code>Type: *int
  panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x483c7d]
  
  goroutine 1 [running]:
  main.main()
      /home/aaron/projects/gopath/src/github.com/AaronNBrock/go-guess/main.go:16 +0x9d
  exit status 2
  </code></pre>
  <p>I see that the error is with the <code>*guess = 12345</code> since <code>12345</code>, but I'm not sure what's causing it.</p>