Skip to content

Instantly share code, notes, and snippets.

@michaelbartnett
Created April 24, 2011 08:38
Show Gist options
  • Save michaelbartnett/939407 to your computer and use it in GitHub Desktop.
Save michaelbartnett/939407 to your computer and use it in GitHub Desktop.
Clockwise spiral for malloc lab
+-------------------+
| +----------+ |
| | +-+ | |
| ^ ^ | | |
*(size_t *)p = size;| |
^ ^ ^ | | |
| | +---+ | |
| +-----------------+ |
+---------------------+
Each item in this list points to the spiral's intersection with the code starting from 'p'.
1. p -> The variable p
2. * -> is a pointer to a value
3. size_t -> of type size_t.
4. * -> Indirection operator. Indicates that although we've gone through all this trouble to make p a (size_t *), that we actually want to look at the memory address pointed to by p.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment