package main
import "fmt"
type Student struct {
Id string
Name string
Age int
}
func main() {
student := Student{
Id: "st01",
Name: "Name 1",
Age: 20,
}
ptr := &student
fmt.Println("Student Info")
fmt.Println(*ptr)
ptr.Id = "st02"
ptr.Age = 22
ptr.Name = "Name 2"
fmt.Println("Student Info")
fmt.Println(*ptr)
}
Output
Student Info
{st01 Name 1 20}
Student Info
{st02 Name 2 22}