I'm going to write the understanding of Go from the basics of programming!
Computers have something like a work space called memory Variables are recorded in that memory and their location is called an address
Often expressed in hexadecimal, such as "0xc420010230" Hexadecimal is a counting method that increases by 16 when counting numbers.
func main() {
name := "tanabe"
fmt.Println(name) //Get value by name
fmt.Println(&name) //&Get address by name
//console
tanabe
0xc421100230
To get the address of a variable, use "& variable name" Because the recording location in memory depends on the computer A different address may be output each time the program is executed.
Recommended Posts