Skip to main content

Checkpoint: Modeling Under Contract

intermediate22 min readLesson 104 of 148

Prove you can model with structs, enforce invariants through an API, and document ownership.

The task

Implement the declared BQueue API (see the challenge) exactly to contract: FIFO order, the queue owns copies of its strings, -1 on full/empty/bad args, NULL-tolerant, fixed capacity 8, strings up to 31 characters.

Passing this proves: struct modeling with invariants enforced behind an opaque handle, ring-buffer index arithmetic, and the discipline of return-code contracts.

Next module: strings as data — buffers, boundaries, and parsing.