C Program to Compute sum of the array elements using pointers !

   

Write a ‘C’ Program to compute the sum of all elements stored in an array using pointers

C Program to compute sum of the array elements using pointers

Program :

Output :

Explanation of Program :

Accept the 10 elements from the user in the array.

We are storing the address of the array into the pointer.
Now in the for loop we are fetching the value from the location pointer by pointer variable. Using De-referencing pointer we are able to get the value at address.
Suppose we have 2000 as starting address of the array. Then in the first loop we are fetching the value at 2000. i.e
In the Second iteration we will have following calculation -