Перейти к содержанию
English

A problem from last lesson

  • In lesson 5, 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.

int x holds 5 at address 0x100; int *p holds 0x100 and points to x; *p is 5

Раздаточный материал

Войти или создать аккаунт

IGCSE, A-Level & AP