networking · beginner · ~15 min
Recognise local-only test targets.
Implement int is_localhost(const char *host) returning 1 for "localhost", "127.0.0.1", or "::1", else 0.
#include <string.h>
int is_localhost(const char *host) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.