TOC | Prev | Next

void pointers

Pointers to void are pointers to abstract locations in memory,
without any type.

To convert from one type to another, including points, use a cast.

char *name = "OSCON 2009";
void *p = (void *)name;

Casting tells the compiler "I know what I'm doing, changing types
like this, so don't stop me."

Sometimes you have to cast a pointer to void * to pass it around.

In general, void pointers are best left alone. We may see examples
of when to use them later.

TOC | Prev | Next