networking · beginner · ~15 min

Bytes left to send

Track progress through a partial-send loop.

Challenge

send may transmit only part of the buffer. Implement int bytes_remaining(int total, int sent) returning how many bytes are still unsent (total - sent, never negative).

Starter code

int bytes_remaining(int total, int sent) {
    /* TODO */
    return 0;
}

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