CS W1007 Introduction to Computer Science
Eric Siegel, Columbia University
(a.k.a., E-Daddy-Iceberg)

Pointers Rap

Live vocal recording


Eric Siegel wrote and performed this song when he was a computer science professor at Columbia University, 1997 - 2000.

The chorus is sung to a funky tune accompanied by clavichord, and the verses are spoken rhythmically with an attitude, accompanied by a percussive beat.

Sing:

Show me your data, point it out to me.
If I know where it is then I can access easily.
With the asterisk I'll dereference; I can print it out,
and I can even change it, without a doubt.

The ampersand can awesomely tell you the location.
When your program's running smoothly you can go on a vacation.
So a program with no pointer's like an elbow with no joint;
if you follow the pointer, you will get to the point.

Rap:

"Memory's like real estate" -- I'll state and make my metaphore.
You want to get some property, a lot, a plot, a farm, a store.
So allocate your memory and claim it, 'til you use it up.
Otherwise, "memory fault", "core dump", all screwed up!

Variable values are stored at locations...
in memory that is; that's where the space is.
A pointer is some data like an int, char or double,
but you better treat it special or you're gonna be in trouble.

Each location in memory has a memory address.
That address is the number used to find where data rests.
An address is a value, just like any other,
so it is stored in memory like its sisters and brothers.

"All memory's created equally," said William Gates.
(But Microsoft consumers rank as low as big Bill states.)
Values are content or pointers; I prefer the latter.
Pointers are meta-data tellin'-me where is what that matters.

Sing

Rap:

An array's just a pointer, it turns out, so whatta ya know?
It's a pointer to yer data, all set out in a row.
That's why when ya pass it, it's always by reference;
the function that gets it can index and dereference it.

It's not polite to point; it's totally rude.
But the data that you point to might be a pointer, dude,
and that can point me elsewhere, ultimately,
A pointer to a pointer and I'm meta-meta-C

Don't dereference a NULL pointer; you should not abuse it.
Value memory's values; use it or lose it.
In Java, everything is a pointer, consistently.
But "C" is for "cookie" and that's good enough for me!

So, don't forget to dereference a valid pointer,
and don't forget to double-dereference a pointer to a pointer,
and don't forget to triple-dereference a pointer to a pointer to a pointer,
and don't forget to quadruple-dereference a pointer to a pointer to a pointer to a pointer,

Sing

Rap:

Linked lists will be your very first abstract data type.
We saved it 'til the end because now your brain is ripe.
Each element is stored in an allocated structure called a "node";
Each node points to the next one, and "node" rhymes with "toad".

So now you know how to manage memory's massive space.
My first computer had 48k and no lowercase!
The past is gonna haunt us though your computer's better than mine,
'cause next year we're gonna party like it's 1899.

Sing


© 1998 Eric V. Siegel