In this section, we're going to observe D's take on pointers, arrays, strings, and associative arrays. Much of what we'll cover here is very different from other C-family languages.
As in other languages that support them, pointers in D are special variables intended to hold memory addresses. Take a moment to compile and run the following:
int* p; writeln("p's value is ", p); writeln("p's type is ", typeid(p)); writeln("p's size is ", p.sizeof);
First, look at the declaration. It should look very familiar to many C-family programmers. All pointer declarations are default initialized to
null, so here the first call to
"null" as the value. The type of
p printed in the second
int*. The last line ...