Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is dereferencing a pointer called dereferencing?

Why is dereferencing called dereferencing?

I'm just learning pointers properly, and I'd like to know why dereferencing is called that. It confused me as it sounds like you are removing a reference, rather than going via the pointer to the destination.

Can anyone explain why it is called this?

To me something like destination or pointed_to_value would make more sense.

like image 443
Chris Barry Avatar asked May 26 '10 18:05

Chris Barry


People also ask

Why is it called dereferencing a pointer?

Dereferencing means taking away the reference and giving you what it was actually referring to. A pointer to something really means that your pointer variable holds a memory address of something . But the pointer can also be thought of as a reference to something instead.

What dereference means?

(programming) To access the value or object located in a memory location stored in a pointer or another value interpreted as such; to access a value being referenced by something else.

What does dereferencing mean in Java?

So according to whoever created the Java 8 exam, dereferencing in Java is the act of reassigning a reference, rather than the act of evaluating a reference: For example: // Create an Integer object, and a reference to it.

What is a dereference in C?

In computer programming, a dereference operator, also known as an indirection operator, operates on a pointer variable. It returns the location value, or l-value in memory pointed to by the variable's value. In the C programming language, the deference operator is denoted with an asterisk (*).


1 Answers

A pointer refers to an object. Ergo, we dereference the pointer (or, get the referent of the pointer) to get the object pointed-to.

The de- prefix most likely comes from the Latin preposition meaning from; I suppose you could think of dereference as meaning "to obtain the referent (or object) from the reference."

like image 124
James McNellis Avatar answered Oct 05 '22 21:10

James McNellis