type student struct { name string id int } func main() { stu := student{"wjc",11} test(&stu.id) fmt.Println(stu) } func test(id *int) { *id++ }
Pointer can also be used in the field struct.
type student struct { name string id int } func main() { stu := student{"wjc",11} test(&stu.id) fmt.Println(stu) } func test(id *int) { *id++ }
Pointer can also be used in the field struct.