Curriculum Types & methods Pointers
Pointers
&x takes the address of x. *p dereferences p. Pointers in Go are pointers — they're not garbage-collector-hostile, they don't do arithmetic (no p++), and they don't bite. They're the explicit version of "by reference" — TypeScript hides this behind "objects are references," Go makes it visible.
9 ready
01
pick oneTypeScript hides pointer-vs-value behind "objects are
02
pick one Pick the line that DECLARES a pointer p holding the address
03
pick oneWhat's the ZERO VALUE of a pointer? Same question as theme 3.1
04
fill blanks Take the address of x to create the pointer. The blank is the
05
fill blanks Dereference p to read the value it points at. The blank is
06
type one line TypeScript can't pass an int by reference — primitives copy
07
type one line Construct a *User pointing at a freshly-initialised User
08
write a programWrite a complete program that:
09
write a program Theme capstone: a describe(p *int) function that prints either