networking · beginner · ~15 min

Does binding need privilege?

Know which ports require privilege to bind.

Challenge

Implement int needs_root_to_bind(int port) returning 1 if port is a privileged port (1..1023), else 0.

Starter code

int needs_root_to_bind(int port) {
    /* TODO */
    return 0;
}

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