We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Dangerous Push

Up until now, even though we made our stack with void *, you'll notice that we've only stored plain old int pointers. I want to show you that you can actually store anything in the stack, even heterogeneous lists! That being said, this is usually a bad idea.

TJ likes to use words like "heterogeneous" to keep kids-who-don't-read-good at bay. He meant to say, "you can actually store anything in the stack, even lists of different types of data!"

Now, we're going to do something pretty gross to demonstrate the wise words of one of the philosophers of our time:

With great power comes great responsibility.

-- Uncle Ben

I'm going to have you push an int * and a regular old int directly onto the stack (a bad idea). I just want to show you that you can store anything in a void *, even values that aren't pointers at all.

Assignment

Complete the scary_double_push function.