CJCoding With Joseph
15free / daySign inCreate account

Walk an Array of Prices with Pointer Arithmetic

The array prices and a pointer p to its first element are already declared. Inside the loop, print each item and add it to total - but reach the elements with *(p + i), not with prices[i].

Expected Output:

Item 0: 4
Item 1: 9
Item 2: 2
Item 3: 7
Item 4: 3
Total: 25

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
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 (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.