networking · beginner · ~15 min
Detect the socket() error sentinel.
Implement int socket_failed(int fd) returning 1 if fd < 0, else 0.
int socket_failed(int fd) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.