cybersecurity · intermediate · ~15 min · safe pentest lab

Count 404 responses

Count lines matching a status token.

Challenge

Implement int count_404s(const char *log) returning the number of lines that contain " 404 " (the HTTP status surrounded by spaces).

Starter code

#include <string.h>

int count_404s(const char *log) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.