Introduction
I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
#include <iostream> using namespace std; int main() { int arr[5], i, sum = 0; int *ptr; cout << "Enter any 5 numbers :"; for (i = 0; i < 5; i++) { cin >> arr[i]; } ptr = arr; for (i = 0; i < 5; i++) { sum = sum + *(ptr + i); } cout << "\nSum of array elements :" << sum; return 0; }
Result
![Write C++ program to Sum of Array Elements using Pointers](https://techstudys.com/wp-content/uploads/2021/07/3-11.png)
NICE ONE!!!
Thank you very much !
can u please explain some more example of pointers 3 part (sum of the array)