Skip to content

Pointers: &, *, and pass-by-pointer

Handout

A problem from last lesson

  • Last lesson, a function got a copy of your number. Changing the copy did not change the original.
  • C copies every argument you pass to a function. So a normal function cannot change your variable.
  • To change it, the function needs the variable's address — where it lives in memory.

x holds 5 at address 0x100; pointer p holds 0x100, so *p reaches 5

Handout

Log in or create account

IGCSE & A-Level