networking · beginner · ~15 min

Well-known port?

Recall the privileged port range.

Challenge

Implement int is_well_known_port(int p) returning 1 if p is in the well-known range 1..1023 (which require privilege to bind), else 0.

Starter code

int is_well_known_port(int p) {
    /* TODO */
    return 0;
}

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