Skip to content · ⁨Bỏ qua nội dung⁩

Pointers: &, *, and pass-by-pointer · ⁨Con trỏ: &, *, và truyền qua con trỏ⁩

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 · ⁨Tài liệu⁩

Log in or create account · ⁨Đăng nhập hoặc tạo tài khoản⁩

IGCSE, A-Level & AP