...

/

The Access Operator and the Dot Operator

The Access Operator and the Dot Operator

Learn about the use of access and dot operators.

The access operator *

Earlier, you saw that the * character, which normally represents multiplication is also used when defining pointers. However, a difficulty with the syntax of pointers is that the same character has a third meaning: It is also used when accessing the pointee through the pointer.

When * is written before the name of a pointer, it refers to the variable that the pointer is pointing at (i.e., the pointee):

Press + to interact
import std.stdio;
void main () {
int myVariable = 180;
int * myPointer = &myVariable;
writeln("The value that it is pointing at: ", *myPointer);
}

Using the . operator to access a member of the pointee

If you know pointers from ...