当前位置:网站首页>Go language: passing slices between functions
Go language: passing slices between functions
2022-04-23 12:56:00 【Play ha ha 527】
package main
import "fmt"
// Passing slices between functions
func main() {
// Allocation contains 10 Slices of integer values
slice:= make([]int, 10)
// take slice Pass to function foo
var slice1 []int
slice1= foo(slice)
// function foo Receive an integer slice , And back to this slice
fmt.Print(slice1)
}
func foo(slice []int) []int {
slice=append(slice,3)// Append an element to the slice 3
return slice
}
/* printout [0 0 0 0 0 0 0 0 0 0 3] */
版权声明
本文为[Play ha ha 527]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230615231376.html
边栏推荐
- XinChaCha Trust SSL Organization Validated
- Can I take the CPDA data analyst certificate for 0 foundation
- Trier les principales utilisations de l'Agent IP réseau
- BUUCTF WEB [BUUCTF 2018]Online Tool
- leetcode:437. 路径总和 III【dfs 选还是不选?】
- [wechat applet] Z-index is invalid
- Markdown grammar learning
- 拥抱机器视觉新蓝海,冀为好望开启数字经济发展新“冀”遇
- php生成json处理中文
- 产品开发都应该知道的8个网站,增强工作体验
猜你喜欢
梳理网络IP代理的几大用途
How to click an object to play an animation
STM32工程移植:不同型号芯片工程之间的移植:ZE到C8
CGC: contractual graph clustering for community detection and tracking
Bert base Chinese Download (SMART)
Introduction to metalama 4 Use fabric to manipulate items or namespaces
31. 下一个排列
Pytorch: a pit about the implementation of gradreverselayer
leetcode:437. Path sum III [DFS selected or not selected?]
Aviation core technology sharing | overview of safety characteristics of acm32 MCU
随机推荐
Servlet监听器&过滤器介绍
Object. The disorder of key value array after keys
Fashion cloud learning - input attribute summary
如何防止网站被黑客入侵篡改
BUUCTF WEB [BJDCTF2020]ZJCTF,不过如此
22. 括号生成
Can I take the CPDA data analyst certificate for 0 foundation
SSM框架系列——数据源配置day2-1
leetcode-791. 自定义字符串排序
4. DRF permission & access frequency & filtering & sorting
Redis deployment of cloud native kubesphere
leetcode-791. Custom string sorting
解决disagrees about version of symbol device_create
云原生KubeSphere部署Redis
洛谷P5540 [BalkanOI2011] timeismoney | 最小乘积生成树 题解
Plato Farm-以柏拉图为目标的农场元宇宙游戏
Buuctf Web [gxyctf2019] no dolls
The accuracy and speed are perfectly balanced, and the latest image segmentation SOTA model is released!!!
Embrace the new blue ocean of machine vision and hope to open a new "Ji" encounter for the development of digital economy
Zero trust in network information security