当前位置:网站首页>Go language - value types and reference types
Go language - value types and reference types
2022-06-11 15:45:00 【Crying while learning】
Value type and reference type
Value type :int、float、bool、string、 Array array、 Structure struct
Reference type : The pointer 、 section slice、map、 Interface interface、 function func、 The Conduit chan
difference
Value type :
- Variables store values directly , Memory is usually allocated in the stack .
- When assigning a value to a new variable ( When copying ), Is a deep copy , Directly create a new memory address to store values .
Reference type :
- Variables store memory addresses directly , This address stores values . Memory is usually reallocated on the heap .
- When assigning a value to a new variable ( When copying ), For light copy , The new variable points to the original memory address through a pointer . have access to copy Keyword implements a deep copy of the reference type .
- When no variable references this address , This address will be GC Garbage collection .
边栏推荐
- 07 _ 行锁功过:怎么减少行锁对性能的影响?
- [digital signal processing] correlation function (correlation function property | conjugate symmetry property of correlation function | even symmetry of real signal autocorrelation function | conjugat
- Arthas practice documentation
- [multi thread performance tuning] what operations cause context switching?
- 04 _ 深入浅出索引(上)
- Uniapp développe des applets Wechat, de la construction à la mise en ligne
- 使用Cloud DB构建APP 快速入门-Server篇
- Unified record of my code variable names
- Kaixia takes the lead in launching a new generation of UFS embedded flash memory devices that support Mipi m-phy v5.0
- 让快递快到来不及退款的,真的不是人
猜你喜欢

测试9年,面试华为要薪1万,华为员工:公司没这么低工资的岗
![[multi thread performance tuning] what operations cause context switching?](/img/a6/5d82c81dba546092447debebf7fc3e.jpg)
[multi thread performance tuning] what operations cause context switching?

三千字教你使用MOT

Lick the dog till the last one has nothing (linear DP)

【创建型模式】原型模式

After nine years of testing, the salary for interviewing Huawei is 10000. Huawei employees: the company doesn't have such a low salary position

Verification code is the natural enemy of automation? Ali developed a solution

openGauss数据库闪回功能验证

零基础自学软件测试,我花7天时间整理了一套学习路线,希望能帮助到大家..

I have used 20K for 5 years and met all major manufacturers. These high-frequency interview questions have helped you figure out
随机推荐
[0006] title, keyword and page description
[creation mode] abstract factory mode
[azure application service] nodejs express + msal realizes the authentication experiment of API Application token authentication (AAD oauth2 idtoken) -- passport authenticate('oauth-bearer', {session:
【愚公系列】2022年06月 .NET架构班 077-分布式中间件 ScheduleMaster加载程序集定时任务
The reason why it is easy to let the single chip computer program fly
2022 Tibet's latest eight major construction personnel (labor workers) simulation test question bank and answers
What is the future of software testing in 2022? Do you need to understand the code?
The most egregious error set of tone codes
[creation mode] prototype mode
Lick the dog till the last one has nothing (linear DP)
Is it possible to use multiple indexes together in a query?
每日一博 - 微服务权限一二事
数据库资源负载管理(上篇)
数据库密态等值查询概述及操作
使用Cloud DB构建APP 快速入门-Server篇
openGauss 3.0.0版本正式发布,立即体验社区首个轻量版本
04 _ In simple terms index (I)
网站上的 breadcrumb 使用场景浅析
企业开发如何写出优雅的二级分类【美团小案例】
[creation mode] builder mode