← Back to Pointers
Question 436
Pointer Difference Gives the Index
Pointer Difference Gives the Index
The array line holds {5, 10, 15, 20, 25, 30, 35, 40}. Pointer start points at line[2] and pointer end points at line[6].
Fill in the three TODO lines. Cast each pointer subtraction before printing with %d, for example (int)(end - start).Expected Output:
Elements apart: 4 Start index: 2 End index: 6
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.