networking · beginner · ~15 min

Is it an internet family?

Identify the IP address families.

Challenge

Implement int is_inet_family(int af) returning 1 if af is AF_INET or AF_INET6, else 0.

Starter code

#include <sys/socket.h>

int is_inet_family(int af) {
    /* TODO */
    return 0;
}

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