Skip to main content

Checkpoint: The Two-File Build

Challenge on lesson: Checkpoint: Translation Units & Linkage

Model an entire two-TU build and its failure modes in one API: ``c /* files: 'C' = compile OK, 'c' = compile ERROR, 'L' = links, 'l' = link ERROR. A build string is a sequence like "CCLl" — per-TU compile results followed by the link result. */ int build_verdict(const char *stages); ` Rules: if any compile stage is 'c', the build fails at that point — return -1 - <index of first failing TU> (first TU is index 0). Otherwise if the link result is 'l', return -100`. Otherwise return the number of successful TUs. NULL or empty returns -1. Extra characters (spaces) are skipped.

Difficulty: intermediate

Back to lesson: Checkpoint: Translation Units & Linkage