当前位置:网站首页>2022-07-24: what is the output of the following go language code? A:[]int{}; B:[]int(nil); C:panic; D: Compilation error. package main import ( “fmt“ ) f
2022-07-24: what is the output of the following go language code? A:[]int{}; B:[]int(nil); C:panic; D: Compilation error. package main import ( “fmt“ ) f
2022-07-25 05:02:00 【Fuda frame constructor daily question】
2022-07-24: following go What language code outputs ?A:[]int{};B:[]int(nil);C:panic;D: Compile error .
package main
import (
"fmt"
)
func f(a ...int) {
fmt.Printf("%#v\n", a)
}
func main() {
f()
}
Answer selection B, But there is 58% Selected by the user of A. First ,a The type is []int, call f when , No parameters passed , So the equivalent value is nil, namely a The type is []int, The value is nil. and fmt.Printf It's a simple verb %#v Type and value will be printed at the same time . So the result is B.
边栏推荐
- [c language] custom type (structure ~ enumeration ~ Union)
- 二、MySQL数据库基础
- The strongest JVM in the whole network is coming!
- GDT,LDT,GDTR,LDTR
- 38 lines of PHP code free import database analysis Linux access log
- Redis的三个必知必会的问题
- [wechat applet] picker scroll selector (85/100)
- Purpose of setting novice task period in the integral system
- 2022-7-15 summary
- Now the operator wants to check the answer details of all user questions from Zhejiang University. Please take out the corresponding data
猜你喜欢

2、 Mysql database foundation

How can test / development programmers with 5 years of experience break through the technical bottleneck? Common problems in big factories

Getting started with scratch

Wechat official account all article download links to get

Teach you how to locate unreasonable SQL? And optimize it

Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life

龙蜥社区发布首个 Anolis OS 安全指南 为用户业务系统保驾护航

Gradle test and idea test

Interview required: how to design the seckill system?

Li Kou 731. My schedule II
随机推荐
学习记录[email protected]研发效能度量指标
小红书携手HMS Core,畅玩高清视界,种草美好生活
Analysis of lottery winning numbers in history
Token value replacement of burpsuite blasting
Document collaboration tool recommendation
Thinking from the perspective of Aya
If you don't know these 20 classic redis interview questions, don't go to the interview!
QT download installation tutorial
Teach you three ways to optimize the performance from 20s to 500ms
[wechat applet] picker scroll selector (85/100)
Natural state is the best
STM32 Development Notes 119: what macros are required to enable FPU?
STM32 Development Notes 121: Kalman filter I understand
Anaconda installs jupyter
Gbase 8A about no suitable driver
GDT,LDT,GDTR,LDTR
Construction of Seata multilingual system
rhcsa暑假第三天
Logu p3398 hamsters find sugar solution
Druid connection pool - strong self-study from 0. Those who don't understand Druid can click in. If you know not to click in, you will think I'm wordy