Skip to main content

Practice ยท 2 of 2

A Type-Safe Stack Facade

The boilerplate provides an int-stack and a double-stack with concrete functions (si_push, sd_push, ...). Implement ONLY the _Generic dispatch macros: ``c #define stack_push(st, val) /* dispatches to si_push/sd_push by val's type */ #define stack_pop(st, out) /* dispatches to si_pop/sd_pop by *out's type */ `` the type checking (no void*, no runtime tag).

Difficulty: intermediate

Back to lesson: Practice: qsort, bsearch & _Generic Gym