Stage 9

Interactive C Design Playground

Assemble a design from everything you’ve learned: pick a scenario, choose your encapsulation and allocation strategy, and study the complete generated C listing.

9.1 Design bench

ℹ️

How this works: this playground generates real, idiomatic C and a simulated execution trace so you can study cause and effect. No compiler runs in your browser — copy any listing into your own toolchain to run it for real.

🛠︎ Build your design

Simulated output
// press “Build & Run (simulated)” to trace this design

9.2 Things to try

🔒 Toggle “opaque handle” off

Compare the two headers. What can app code touch now? Which version survives a refactor of the struct without breaking callers?

🧱 Toggle “static pool” off

Watch the trace change from pool slots to malloc/free. Which failure modes from the Pitfalls page apply to each strategy?

🎭 Switch to the interface scenario

Find the single line in main.c where behavior is selected. That line is the whole point of the ops-table pattern.