当前位置:网站首页>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 .
边栏推荐
- 前沿科技探究之AI在索引推荐的应用
- C interface of learning notes
- 【创建型模式】工厂方法模式
- 泰雷兹云安全报告显示,云端数据泄露和复杂程度呈上升趋势
- 使用Cloud DB构建APP 快速入门-快游戏篇
- 向数据库导入数据?试试COPY FROM STDIN语句
- 同学,你听说过MOT吗?
- 前沿科技探究DeepSQL:库内AI算法
- [creation mode] prototype mode
- [azure application service] nodejs express + msal realizes the authentication experiment of API Application token authentication (AAD oauth2 idtoken) -- passport authenticate('oauth-bearer', {session:
猜你喜欢

openGauss 多线程架构启动过程详解
![[multi thread performance tuning] what operations cause context switching?](/img/a6/5d82c81dba546092447debebf7fc3e.jpg)
[multi thread performance tuning] what operations cause context switching?

Google Earth engine (GEE) - create a simple panel demo to display the map

Hebei huangjinzhai scenic spot adds "AED automatic defibrillator" to ensure the life safety of tourists!

02 _ 日志系统:一条SQL更新语句是如何执行的?

Qcustomplot 1.0.1 learning (1) - Download and use qcustomplot

MOS transistor 24n50 parameters of asemi, 24n50 package, 24n50 size

【创建型模式】单例模式

关于 JS 函数的一切

GO语言-Slice切片
随机推荐
leetcode 120. Triangle minimum path sum
了解下openGauss的密态支持函数/存储过程
数据库设计建议
Charles自动保存响应数据
【愚公系列】2022年06月 .NET架构班 078-分布式中间件 ScheduleMaster的Worker集群
DB4AI: 数据库驱动AI
Introduction to JVM basic concepts
Zero foundation self-study software test, I spent 7 days sorting out a set of learning routes, hoping to help you
MOS transistor 24n50 parameters of asemi, 24n50 package, 24n50 size
[系统安全] 四十二.Powershell恶意代码检测系列 (4)论文总结及抽象语法树(AST)提取
Iclr2022| small sample fine tuning method of language model based on differentiable hints
[creation mode] prototype mode
Everything about JS functions
码农必备SQL调优(下)
After nine years of testing, the salary for interviewing Huawei is 10000. Huawei employees: the company doesn't have such a low salary position
How about art plus online school? Is it a new online organization?
openGauss数据库性能调优概述及实例分析
Cf662b graph coloring problem solution
前沿科技探究之AI在索引推荐的应用
02 _ Log system: how does an SQL UPDATE statement execute?