Skip to content

Instantly share code, notes, and snippets.

@inancgumus
Created October 2, 2017 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inancgumus/9742d22a69a96448ef94c0becb0e1155 to your computer and use it in GitHub Desktop.
Save inancgumus/9742d22a69a96448ef94c0becb0e1155 to your computer and use it in GitHub Desktop.
Go sizeof
package main
import (
"fmt"
"unsafe"
)
func main() {
var ageOfUniverse int
reservedBytes := unsafe.Sizeof(ageOfUniverse)
fmt.Printf("Number of bytes reserved for `ageOfUniverse` variable is %d bytes.\n",
reservedBytes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment