Pal the Pointer

and his Computer Chums!

Hello! My name is Pal, and I am a POINTER: which means I point to things.


Sometimes I point to an integer...

Pal points to an integer

At other times I point to a floating point number...

Pal points to a float

And sometimes I point to another pointer!

Pointers to pointers to pointers...

Now, with all of this pointing around, I often am confused for somebody I'm not:

A Question of Identity

...which is pretty exasperating.


But that's enough about me. I want to talk about my friends. Because if a pointer had nobody to point to, well... he just wouldn't be himself, now, would he?

Some of my best friends are symbols. And, really, it's not because I like to make life difficult for Computer Science students. (Really.) Here are a few of my best symbolic friends:

A friend is somebody you can point to.

The symbol on the left is what I tell misdirected souls to use when they don't really want me, they want my friend. (It's startling how many people'll use you to get to someone else.) What that little asterisk does is direct you to what I'm pointing to. Terribly useful... I would never be any help without it.

But an asterisk without an ampersand's a shame... for if I want to point to anything, I need to know where it is. And that's what my buddy the ampersand does. Use it when you want to point me to anything. Anything!

The third symbol, the caret, is a little different. If you've ever programmed in Pascal, you'll recognize it as being what the asterisk is in C++. But in C++, it's the bitwise XOR operator... different languages do the same things in different ways. I have a hard time conversing with my fellow pointers who speak Pascal... but at least I know how to recognize them.

The fourth symbol is used in a special way for accessing members of a struct that I'm pointing at. You can get along without it, but he's still my friend.

Functions are also some of my best friends. They live in black boxes so you can't see what's going on inside of them. Here's a picture of one of my favorite function friends:

Pal's function friend

Then there's my friend, Null. He doesn't really exist, but we all like to pretend that he does.

Pal's Friend NULL

You can make complex types using pointers. Everytime you declare a pointer to a data type, you've made a new, compound data type.

Soon you're going to hear all about objects and classes, which are, in a certain sense, a new kind of complex type.

The kind of complex types you may make using pointers is limited only by your imagination. You can have

pointers to pointers,
pointers to pointers to pointers,
pointers to an array of pointers,
pointers to an array of pointers to pointers,
pointers to pointers to arrays of pointers,
pointers to pointers to pointers to pointers...

Why, the list goes on and on forever. (And wasn't there an ancient creation myth which said the world was supported on an endless succession of pointers?)

Ancient pointer creation myth

Some people think that the idea of pointers is confusing...

It can all be confusing, I know...

...and I guess that it is.


There's pointers to pointers, pointers to structures, pointers to structures containing pointers to pointers, arrays of pointers pointing to functions which return a pointer to a structure which contains a pointer to an array of pointers pointing to functions which... why, it goes on forever and ever. And if you don't believe me...

...oh, well, I'll just point one more thing out.

You might think a job pointing at things would be somewhat boring. And though it's true I'm sometimes given menial tasks, it's always rewarding to have a big one:

Pal at his really big job

Home Eclectic Lunchbox of Delights The Code Lair The Reading Room The Inkwell The Globe The Music Box ChrisNewz! Projection Room The Dugout Department of Antiquties Math Department Special Extras! Link-a-dink-a-doo Site index (by topic)