MCPcopy Create free account
hub / github.com/mmcgrana/gobyexample / zeroval

Function zeroval

examples/pointers/pointers.go:14–16  ·  view source on GitHub ↗

We'll show how pointers work in contrast to values with 2 functions: `zeroval` and `zeroptr`. `zeroval` has an `int` parameter, so arguments will be passed to it by value. `zeroval` will get a copy of `ival` distinct from the one in the calling function.

(ival int)

Source from the content-addressed store, hash-verified

12// value. `zeroval` will get a copy of `ival` distinct
13// from the one in the calling function.
14func zeroval(ival int) {
15 ival = 0
16}
17
18// `zeroptr` in contrast has an `*int` parameter, meaning
19// that it takes an `int` pointer. The `*iptr` code in the

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected