

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 8
click for more info
Not enough gems
Cost: 6 gems
1: Low Level Stack
incomplete
2: Stack Push
incomplete
3: Stack Pop
incomplete
4: Stack free
incomplete
5: Dangerous Push
incomplete
6: Multiple Types
incomplete
This lesson's interactive features are locked, please to keep using them
So we saw that we can push both int and int * types into the same stack (again, a bad idea).
In this example, we'll see that not only can you push values and pointers into the same stack, but you can also push different types of values into the same stack.
This is once again a terrible idea, but the thrust of what we're getting at here is:
C doesn't care what you put in memory, it's bytes all the way down.
Fortunately, C doesn't let you do these conversions automatically... but it still lets you do them. When you're working with void *, you're working with raw memory addresses, and you can cast them to whatever you want.
Complete the stack_push_multiple_types function.
Remember to leave room for the null terminator (\0)!
Don't forget to use the string.h library when working with char * types.