networking · beginner · ~15 min
Recognise the IPv6 loopback address.
Recognise the IPv6 loopback address — the v6 equivalent of 127.0.0.1.
Implement int is_ipv6_loopback(const char *addr).
addr: a NUL-terminated IPv6 address string.Return 1 if addr is exactly "::1", else 0.
is_ipv6_loopback("::1") -> 1
is_ipv6_loopback("::2") -> 0
addr: a NUL-terminated IPv6 address string.
1 if addr is exactly "::1", else 0.
Exact string match against "::1".
#include <string.h>
int is_ipv6_loopback(const char *addr) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.