networking · beginner · ~15 min

Did we receive the whole message?

Verify the assembled message length.

Challenge

Implement int all_received(const int *per_read, int n, int expected) returning 1 if the sum of the n per-read byte counts equals expected, else 0.

Starter code

int all_received(const int *per_read, int n, int expected) {
    /* TODO */
    return 0;
}

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