Skip to main content

Checkpoint: Pointer Forensics

Challenge on lesson: Checkpoint: Pointers as Addresses

Given the pointer model below, implement the analyzer: ``c /* a[] has n elements; lo, hi are pointers claimed to be inside [a, a+n]. Return: 0 if lo..hi form a valid ascending run (each element > previous), -1 if any input is invalid (NULL a; lo or hi outside [a, a+n]; hi < lo), 1 if the run is valid range but not strictly ascending, 2 if the run contains exactly one element. */ int run_classify(const int *a, size_t n, const int *lo, const int *hi); ``

Difficulty: intermediate

Back to lesson: Checkpoint: Pointers as Addresses