linux-sysprog · beginner · ~15 min
Scan a descriptor table.
An fd table uses -1 for a closed slot. Implement int count_open_fds(const int *table, int n) returning how many slots are open (!= -1).
int count_open_fds(const int *table, int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.