Checkpoint: Layout Clinic Verdict
Challenge on lesson: Checkpoint: Layout Clinic Verdict
CHALLENGE
Difficulty: advanced+25 XP
ISO C. Given struct fat { int id; int score; char name[60]; }; (declared for you), implement size_t touched_bytes(const char *layout, size_t n) โ for layout 'interleaved' return n * sizeof(struct fat); for 'split' return n * 2 * sizeof(int) (the hot fields only: id + score, stored in their own array); any other layout (or NULL) returns (size_t)-1. n == 0 returns 0 for any valid layout.
Press Submit to check your solution.
Back to lesson: Checkpoint: Layout Clinic Verdict