当前位置:网站首页>2022-07-24:以下go语言代码输出什么?A:[]int{};B:[]int(nil);C:panic;D:编译错误。 package main import ( “fmt“ ) f
2022-07-24:以下go语言代码输出什么?A:[]int{};B:[]int(nil);C:panic;D:编译错误。 package main import ( “fmt“ ) f
2022-07-25 04:49:00 【福大大架构师每日一题】
2022-07-24:以下go语言代码输出什么?A:[]int{};B:[]int(nil);C:panic;D:编译错误。
package main
import (
"fmt"
)
func f(a ...int) {
fmt.Printf("%#v\n", a)
}
func main() {
f()
}
答案选B,但却有 58% 的用户选的 A。首先,a 的类型是 []int,调用 f 时,没有传递任何参数,因此相当于值是 nil,即 a 的类型是 []int,值是 nil。而 fmt.Printf 的动词 %#v 会同时打印类型和值。所以结果是 B。
边栏推荐
- 很多时候都是概率
- Basic knowledge of scratch crawler framework
- How can test / development programmers with 5 years of experience break through the technical bottleneck? Common problems in big factories
- HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier
- This low code reporting tool is needed for data analysis
- Gbase JDBC connection database exception
- Mit.js: small event publishing and subscription library
- How to merge cells in a table by markdown
- [wechat applet] picker scroll selector (85/100)
- Gradle test and idea test
猜你喜欢

MongoDB的安全认证详解

二、MySQL数据库基础

Interviewer: explain the core principle of ThreadLocal

Paper:《Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Condi

Ffmpeg download and installation
![Introduction to fundamentals of operations research [1]](/img/79/b613bff74a78ad63f202b9e652220d.png)
Introduction to fundamentals of operations research [1]

Actual combat | record an attack and defense drill management
搭建私有CA服务器

Construction of Seata multilingual system

Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life
随机推荐
Detailed explanation of security authentication of mongodb
ESWC 2018 | R-GCN:基于图卷积网络的关系数据建模
How to transfer NFT metadata from IPFs to smart contracts
哪种网站适合物理服务器
OA and fansoft Bi cross system users, departments and posts synchronous summary
In depth understanding of service
数据湖(十六):Structured Streaming实时写入Iceberg
How to get the database creation time?
Now the operator wants to check the answer details of all user questions from Zhejiang University. Please take out the corresponding data
Unity LOD
Unity LOD
Compile ue5.0
ESWC 2018 | r-gcn: relational data modeling based on graph convolution network
Introduction to FileStream class of C #
[untitled]
很多时候都是概率
Pyg builds GCN to realize link prediction
Novel capture practice
Style transfer -- CCPL: contrast coherence preserving loss for versatile style transfer
Information System Project Manager --- Chapter IX examination questions of project human resource management over the years