Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Address, pointer, dereferencing?

También llamado: address (of an object) · pointer · dereferencing

Definition 4.1 University Computer Science — Year 1 · Capítulo 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.
Leer en el capítulo →