Skip to content
Quiz · Pointers · lesson 4 of 8

Quiz — by value or by reference

What does the program print?

GO
package main

import "fmt"

func change(n int, p *int, s []int) {
    n, *p, s[0] = 10, 20, 30
}
func main() {
    a, b, s := 1, 2, []int{3}
    change(a, &b, s)
    fmt.Println(a, b, s[0])
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way