mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 07:34:06 +08:00
13 lines
215 B
Go
13 lines
215 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func f(a [3]int) { fmt.Println(a) }
|
|
func fp(a *[3]int) { fmt.Println(a) }
|
|
|
|
func main() {
|
|
var ar [3]int
|
|
f(ar) // passes a copy of ar
|
|
fp(&ar) // passes a pointer to ar
|
|
}
|