Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Address, pointer, dereferencing?

Também chamado de: 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.
Ler no capítulo →