What are the latest interview questions in Go language in 2021?
This article introduces the relevant knowledge of "what are the latest interview questions of Go language in 2021". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
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 main
Func main () {
For iPUR.