Home About Technology Travel Pictures
Deutsch

Pointers are elements of many procedural programming languages, which make it possible to access different storage addresses and the data stored there. By it the implementation of many abstract data types such as lists, trees, maps becomes possible. Pointers are often bound to the referencing data type. This makes type checking possible at compile-time.

In the programming language C++ it is possible to manipulate pointers themselves and thus address different storage areas. On the other hand one can use void pointers, thus pointers, whose target datatype is unspecified at compile-time. This way the programmer can easily implement generic data structures. For example one could realize a stack, which stores integer, character or double values alternatively. However, the application must know how to interpret the referenced data.

Here an example [From: Thinking in C++]:

//: C03:VoidPointer.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
int main() {
  void* vp;
  char c;
  int i;
  float f;
  double d;
  // The address of ANY type can be
  // assigned to a void pointer:
  vp = &c;
  vp = &i;
  vp = &f;
  vp = &d;
} ///:~

I chose the domain name voidpointer, because I like the concept of untyped pointers. It can be seen as a synonym for my different personal interests. However I prefer the programming language Java, which does not know pointers but objects...

11.01.2005, Achim Walther, Mail