linux-sysprog · beginner · ~15 min
Apply a resource ceiling.
Implement long clamp_to_limit(long want, long soft_limit) returning want capped at soft_limit (i.e. min of the two).
long clamp_to_limit(long want, long soft_limit) {
/* TODO */
return want;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.