Answer the question
In order to leave comments, you need to log in
How to pass a pointer to a structure to a function?
It is necessary to pass a pointer to a structure to a function, I kind of figured out how to do it, but I don’t know what internal type the struct has, should I substitute it in *Type?
package main
import "fmt"
func out(k *Type) {
fmt.Println(k)
}
func main() {
type Data struct{ Title string }
D := Data{"Title"}
out(&D)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question