+ 1
What's wrong in this code???
package main import "fmt" //passing pointer to function /*func age(num int){ num=25 } func age_year(year*int){ *year=2 } func main() { x:=8 age(x) fmt.Println(x) age_year (&x) fmt. Println (x) }*/ func change(value int){ value=35 } func change_ptr(ptr *int){ *ptr=87 } func main(){ x:=54 change(x) fmt. Println(x) change_ptr (&x) fmt. Println (x) }
2 Answers
+ 2
Thank you
+ 1
What's wrong?
Both codes are working.