Dynamically-sized stack - follow-up 3
Its not a problem but this seems strange:

stack_realloc(p, p-&gt;stackSize - p-&gt;capacityIncrement);


Decreasing the size of the stack when you take elements out. This may cause a lot of work (in your code) if you are near a boundary and do a lot of push/pop combinations. It is unlikely that the memory is actually released by realloc() when shrinking anyway.