void* Pointers and Pointers in Logical Expressions
Learn the use of void* pointers and pointers in logical expressions.
We'll cover the following...
We'll cover the following...
void* can point at any type
Although it is almost never needed in D, C’s special pointer type void* is available in D as well. void* can point at any type:
D
import std.stdio;void main () {int number = 42;double otherNumber = 1.25;void * canPointAtAnything;canPointAtAnything = &number;canPointAtAnything = &otherNumber;writeln(canPointAtAnything);}
The void* above is able to point at variables of two different types: int and double.
void* pointers are limited in functionality. As a consequence of their flexibility, they cannot provide access to the pointee. ...