Saltar al contenido

Punteros: &, *, y paso por puntero

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.

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

Material

Iniciar sesión o crear cuenta

IGCSE, A-Level & AP