What are the latest interview questions in Go language in 2022?
This article mainly introduces the relevant knowledge of the latest interview questions of 2022 Go language, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this latest interview question of 2022 Go language. Let's take a look at it.
1. What happens when compiling and executing the following code?
Package mainvar (size: = 1024 max_size = size*2) func main () {println (size,max_size)}
Parsing test point: variable short pattern variable short pattern restriction:-define variable and explicitly initialize-cannot provide data type-can only be used within the function
Results:
Syntax error: unexpected: =
2. What's wrong with the following function?
Package mainconst cl = 100var bl = 123func main () {println (& bl,bl) println (& cl,cl)}
Parsing points: constant constants are different from variables in allocating memory at run time. Constants are usually expanded directly by the compiler during the preprocessing stage and used as instruction data.
Cannot take the address of cl
3. What happens when compiling and executing the following code?
Package mainfunc main () {for iVOB0TIVI