Checkpoint: Pointer Contracts
Challenge on lesson: Checkpoint: Pointer Contracts
CHALLENGE
Difficulty: advanced+25 XP
A file-scope static double dvals[4]; is already in your editor. Implement three things:
1. size_t span(void) โ how many pointer values dvals + k are computable (including one past the end).
2. unsigned long long dbytes(void) โ the 8 bytes of dvals[0]'s representation, read via memcpy into an unsigned long long (dvals[0] is 1.5, set it in an initializer).\n3. typedef struct counter counter_t; with counter_t *counter_create(void), void counter_visit(counter_t *c, void (*fn)(void *ctx), void *ctx) (calls fn once, per visit), and int counter_count(counter_t *c) returning total visits so far.
Press Submit to check your solution.
Back to lesson: Checkpoint: Pointer Contracts