KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I has encountered an error while implement the below code: package main import ( "fmt" ) type Struct struct { a int b int } func Modifier(ptr *Struct, ptrInt *int) int { *ptr.a++ *ptr.b++ *ptrInt++ return *ptr.a + *ptr.b + *ptrInt } func main() { structure := new(Struct) i := 0 fmt.Println(Modifier(structure, &i)) } That gives me an error something about "invalid indirect of ptr.a (type int)...". And also why the compiler don't give me error about ptrInt? Thanks in advance.
Tags (comma-separated)
Save Edits
Cancel