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

Integer

Let's start simple with a single integer object. The difference between a "snek integer" and a regular C integer is that the Snek integer:

  1. Is allocated on the heap
  2. Can store additional metadata about itself (for now, just its type)

Assignment

Complete the new_snek_integer function in snekobject.c. It should:

If you're curious how this will be used, take a look at the main.c file (where the tests are). You'll see some code that looks like this:

snek_object_t *int_object = new_snek_integer(42);