basics · intermediate · ~15 min
Reconstruct an integer from bytes on the wire.
Network byte order is big-endian. Implement uint32_t read_be32(const uint8_t *b) assembling a 32-bit value from 4 bytes, most-significant first.
#include <stdint.h>
uint32_t read_be32(const uint8_t *b) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.