Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Address, pointer, dereferencing » ?

Aussi appelé : address (of an object) · pointer · dereferencing

Definition 4.1 University Computer Science — Year 1 · Chapitre 4 — Pointers and Arrays

The address of an object is the address of its first byte; the operator & gives it: &n. A pointer is a value that is an address together with the type of what is stored there; a variable declared int *p holds a pointer to an int. The operator * applied to a pointer, *p, designates the object at that address: reading *p reads it, assigning to *p writes into it. Following a pointer in this way is called dereferencing it.

Memory after *p = 7, with made-up addresses (the real ones change from run to run). n occupies the four bytes from address 1000; p, eight bytes from 1008, holds the number 1000. Writing *p writes into the bytes at that number, which are n’s.
Memory after *p = 7, with made-up addresses (the real ones change from run to run). n occupies the four bytes from address 1000; p, eight bytes from 1008, holds the number 1000. Writing *p writes into the bytes at that number, which are n’s.
Lire dans le chapitre →