当前位置:网站首页>Golang ---- storage of variables and their contents
Golang ---- storage of variables and their contents
2022-06-09 04:08:00 【It artist rookie】
First ,& It's address symbol , You can get the memory address of the variable
var a int
a = 45
fmt.Println("&a=", &a) //=>&a= 0xc00000c2b8 16 Base number
This address is different from Java Address of variable in . The address taken here , We can say that it is the address of the variable , You could say 45 The address where this value is located , in other words , The address of a variable is the same as the address of its value ( Arrays are not included here , section ,map These complex types of variables ).
Java The memory address where the value is stored in the variable in , That is to say , The address of a variable and the address of its value are not the same
The address of the variable of the slice type
That is, the address of the first element of the slice
var arr []float32
fmt.Printf("%p&arr=\n", arr)
arr = append(arr, []float32{
11.0, 22, 12, 24}...)
fmt.Printf("%parr=\n", arr)
fmt.Println("&arr=", &arr[0])
fmt.Println("&arr=", &arr[1])
fmt.Println("&arr=", &arr[2])
fmt.Println("&arr=", &arr[3])
fmt.Printf("%parr=\n", arr)
//0x0&arr=
//0xc00000c2d0arr= Same as the address of the first element of the slice
//&arr= 0xc00000c2d0
//&arr= 0xc00000c2d4
//&arr= 0xc00000c2d8
//&arr= 0xc00000c2dc
//0xc00000c2d0arr=
边栏推荐
- golang---并发runtime包
- 2022年【电商】测试优惠券如何编写测试用例?
- Matting function based on pyqt5 - program implementation
- Apple Announces Winner of the 2022 Apple Design Award
- MySQL: common statistics, grouping statistics and time format conversion
- Large factory outsourcing or self research company? How to choose a job for a tester?
- PHP deserialization recurrence - no response to the bugku login
- 测试网站搭建+渗透+审计之第二篇渗透测试
- Test website construction + penetration + audit Part III penetration test of swagger interface
- 强烈推荐这款神器,一行命令将网页转PDF!
猜你喜欢

举例说明tf中LSTMCell的cell、num_unit是什么意思

Rich color changes

Rigidbody2d rotate around a fixed point rotate

软件测试(二)

C language interview tube: talk about the functions of various string functions. I: I don't know. Interviewer: come back for an interview when the young man has learned how to do it.

软件测试工程师,要做到什么程度,一个月才能拿1W?

Experts, how to quickly transform managers?

Noc-sla acquisition C-side business monitoring practice

Memory surge problem location

丰富的色彩变化
随机推荐
Attention OCR Chinese version mas # ter Code Running Logic
目标检测模型mAP计算方法与对比步骤——对比原模型与量化模型之间的mAP
golang---redis操作
举例说明tf中LSTMCell的cell、num_unit是什么意思
基于PyQt5完成的PDF合并
Implementation of horizontal and vertical center of unknown width and height elements
基於FPGA的VGA顯示彩條、字符、圖片
复杂查询 指什么,包括哪些
基于OpenCV的人脸检测、训练、识别
17billion parameters, 28 open test sets SOTA, the industry's largest unified visual multi task model
[word] error! There is no text of the specified style in the document. one
Dapr 1.7 UNIX domain socket he's here
golang---变量与其内容的存放
170亿参数,28项公开测试集SOTA,行业最大的视觉多任务统一大模型来了
Interface performance test: Web service interface test
App上看到就忍不住点的小红点是如何实现的?
Pdf to word based on pyqt5
1264_ Analysis of FreeRTOS task initialization and stack initialization processing
Audio power amplifier circuit (used voice scheme circuit record)
ES6 symbol explanation