Practice · 1 of 4
Predict and Verify Layout
CHALLENGE
Difficulty: advanced+25 XP
Given (in your editor) struct pkt { unsigned char ver; unsigned short len; unsigned int crc; };, implement void layout_report(size_t *off_len, size_t *off_crc, size_t *size) writing offsetof values and sizeof. The tests check the *rules*, not hardcoded numbers: off_len is 2 (after 1-byte ver, aligned to 2), off_crc is 4, size is 8.
Press Submit to check your solution.
Back to lesson: Practice: ABI Contract Drills