Harchaoui
(Abdel Ali Harchaoui)
June 4, 2018, 4:49pm
1
Hi,
i just came across a problem with an example illustrated by Rob Pike in his 3 days talk (2011).
the problem is:
cannot use &ar (type *[3]int) as type[3]*int in argument to f2
is it a change occurred on these last golang version or just something that im not aware of
the code is:
package main
import (
"fmt"
)
func f1(a [3]int) {
fmt.Println(a)
}
func f2(a *[3]int) { // fixed typo.
fmt.Println(a)
}
func main() {
var ar [3]int
f1(ar)
f2(&ar)
}
Harchaoui
(Abdel Ali Harchaoui)
June 4, 2018, 5:15pm
2
Oh Sorry gophers this was my mistake i just realized that i did a bad typo
[3]*int instead of *[3]int.
thank you anyway.
lutzhorn
(Lutz Horn)
June 5, 2018, 7:15am
3
You can edit your first post and fix the typo there. Please also indent every line of code using four spaces. This will make the code much more readable. The button </>
at the top of the edit text box helps you with this.
Harchaoui
(Abdel Ali Harchaoui)
June 5, 2018, 4:04pm
4
Thank you so much. @lutzhorn
system
(system)
Closed
September 3, 2018, 4:04pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.