typeover
curriculum

Curriculum Types & methods Pointers exercise 3 · mcq

Pointers

What's the ZERO VALUE of a pointer? Same question as theme 3.1 exercise 3 was for structs, now scoped to pointer types. TypeScript's rough analog: a variable declared let p: User without an initialiser is undefined. Go gives every type a defined zero value — including pointers. Pick the line that correctly describes Go's behaviour given: ``go var p *int ``

TypeScript reference
Pick the idiomatic Go translation

About this theme

&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.