Skip to main content

Practice ยท 1 of 4

Count the Translation Units

A build compiles two source files, each including two headers. Read the build_log string (a multi-line compile log: one gcc ... -c file.c line per translation unit, then one linking line) and implement: ``c int count_translation_units(const char *build_log); int count_link_errors(const char *build_log); ` count_translation_units returns how many -c compile lines appear. count_link_errors returns how many lines contain undefined reference. Both return 0 for NULL or empty input. Lines are separated by \n`.

Difficulty: intermediate

Back to lesson: Practice: Read the Build