You are given an array of integers and its size n.Using only pointer arithmetic:
❌ Do not use array indexing like arr[I].✅ Only use pointer movements and dereferencing.
Example-1
Input: n = 5, arr = [1 2 3 4 5] Output: 15
Example-2
Input: n = 4, arr = [10 20 30 40] Output: 100
Example-3
Input: n = 3, arr = [-5 5 10] Output: 10
Test Cases
Test Results
Input
5 1 2 3 4 5
Expected Output
15