Skip to main content

Practice ยท 4 of 4

Distance Between

Implement long index_of(const int *begin, const int *end, int target) returning the ELEMENT DISTANCE from begin to the first match, or -1 if absent. Compute with pointer subtraction on a found position.

Difficulty: beginner

Back to lesson: Practice: Arithmetic Workbench