networking · beginner · ~15 min

Did connect succeed?

Interpret connect()'s return.

Challenge

Implement int connect_succeeded(int rc) returning 1 if rc == 0, else 0.

Starter code

int connect_succeeded(int rc) {
    /* TODO */
    return 0;
}

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