k_phanichandra
- 3
- 0
What is the program code in c++ to get the sum of given n numbers using pointers?
type sum(type* p, int n)
{
type sum = 0;
for(int i = 0; i < n; i++) sum += p[i];
return sum;
}