cybersecurity · intermediate · ~15 min · safe pentest lab

Count subdomains of a domain

Filter lines by suffix.

Challenge

Implement int count_of_domain(const char *list, const char *domain) returning how many lines end with domain (e.g. ".example.com").

Starter code

#include <string.h>

int count_of_domain(const char *list, const char *domain) {
    /* TODO */
    return 0;
}

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