file-handling · intermediate · ~15 min
Iterate lines and test each for a token.
A log is a multi-line string. Implement int count_level(const char *log, const char *level) returning how many lines contain level as a substring (e.g. "ERROR").
#include <string.h>
int count_level(const char *log, const char *level) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.