Friday, 3 May 2019

Go Language: Pass by Reference


HelloWorld.go
package main

import "fmt"

func main() {

 name := "Ram"

 changeMe(&name)

 fmt.Println("Hello!!!!! Mr.", name)

}

func changeMe(name *string){
 *name = "Krishna"
}

Output
Hello!!!!! Mr. Krishna


Previous                                                 Next                                                 Home

No comments:

Post a Comment