this says "increment the data c points at" not "increment the pointer"
the function is returning an int instead of a Count On Fri, Jun 19, 2020 at 10:23 AM <christof...@gmail.com> wrote: > Hi, > Please help me understand the below: > I got this from "The Zoo of Go Functions" > > type Count int > > func (c *Count) Incr() int { > *c = *c + 1 //why use *c and not just c, based on (c *Count) c is already > a pointer? > return int(*c) //why cast to int, c is already of type int? > } > > Christof > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/47bb77be-9634-47cb-9899-3bb07328ee50o%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/47bb77be-9634-47cb-9899-3bb07328ee50o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- *Michael T. jonesmichael.jo...@gmail.com <michael.jo...@gmail.com>* -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALoEmQxCr0%2B2cuMP7deP4e9jOK0hDhS%3D%2Bbipd%3DRw0yAH1rWbFA%40mail.gmail.com.