当前位置:网站首页>What is the difference between slice and array in go question bank 12?
What is the difference between slice and array in go question bank 12?
2022-06-28 03:28:00 【GolangRoadmap】
*「 title 」GOLANG ROADMAP Community
*
「 answer 」(engine)
array Is a fixed length array , It's a value type , If you assign a value or use it as a function parameter , In fact, the whole data will be copied again .
The length must be declared before use
arr := [5]int
and slice It's a reference type , It's an indefinite length , Always point to the underlying array array Data structure of . As a function parameter ,slice It's a pointer .
You do not need to specify the length when creating
var s []int
s := make([]int,10)
s :=[]int{1,2,3}
边栏推荐
猜你喜欢
随机推荐
[games] Parkour
SSH框架的搭建(上)
Question bank and answers of special operation certificate for R1 quick opening pressure vessel operation in 2022
【PaddleDetection】ModuleNotFoundError: No module named ‘paddle‘
《Go题库·12》slice和array区别?
Is Guotai Junan Securities reliable? Is it safe to open a securities account?
2022电工(初级)复训题库及在线模拟考试
2022危险化学品经营单位安全管理人员特种作业证考试题库模拟考试平台操作
RichView TRVStyle
基于 WPF 的酷炫 GUI 窗口的简易实现
猴子都会用的圆形滑动自动吸附UI工具
PPT制作小技巧
暴雨去哪儿?天气预报不准谁的锅?
What are the good practices of cloud cost optimization?
Is it safe to buy stocks and open an account through the account opening link of the broker manager? Want to open an account for stock trading
可扩展存储系统(上)
音视频技术开发周刊 | 251
在牛客中使用JS编程题【split】
Solution to not displaying logcat logs during debugging of glory V8 real machine
2022年R1快開門式壓力容器操作特種作業證考試題庫及答案









