Reset The Timer | Sololearn: Learn to code for FREE!

0

Reset The Timer

Does anybody solve this task in Golang?

5/13/2021 5:22:13 PM

Václav Dostál

5 Answers

New Answer

+1

Václav Dostál I did this way: package main import "fmt" type Timer struct { id string seconds int } func main() { var x int fmt.Scanln(&x) t := Timer{"ABC", x} reset(&t) fmt.Println(t) } // my implementation is written below func reset(t *Timer) { t.seconds = 0 }

+1

Previously I didn't know how to solve it, then I found this material in the following link with some examples and it helped me. https://tour.golang.org/methods/5

0

package main import "fmt" type Timer struct { id string seconds int } func reset(t *int) { //t := &Timer{Timer.name, 0} //*x = 0 } func main() { var x int fmt.Scanln(&x) t := Timer{"ABC", x} reset(&t) fmt.Println(t) }

0

This task I mean

0

Nice but I need help with the task Reset The Timer in Golang course.