Answers for "go Arrays in Golang are value types."

Go
0

go Arrays in Golang are value types.

package main

import "fmt"

func main() {
    arrA := [5]string{"Ned", "Edd", "Jon", "Jeor", "Jorah"}
    arrB := arrA

    arrB[1] = "Gendry"

    fmt.Println("array A = ", arrA)
    fmt.Println("array B = ", arrB)
}
Posted by: Guest on October-18-2021

Browse Popular Code Answers by Language