Can someone answer the question below in the first comment of the ChangeRefValue function? Also can anyone provide better explanations of waht's going on here, or a link that explains? Thanks.
playground version: https://play.golang.org/p/8dYdYoL0WI package main import "fmt" func main() { a := 50.50 //sets the value in the created memory space to .... fmt.Println("Value of a is", a) fmt.Println("Addres space of a is", &a) ChangeRefValue(&a) //passing the memory address (pointer) to func fmt.Println("Value of a after func call is", a) } //ChangeRefValue test function func ChangeRefValue(a *float64) { //why does it need to be passed in as a * ? *a = 99.25 //adding a * to the a converts it a value so we can change it globally fmt.Println("Value of *a in func after update is", *a) //print the value from the memory space location fmt.Println("Memory space of a in func after update is", a) //print the memory space address } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.