Question: Given the following code (partial), write a function definitions using pointer notation, and also call function in main using c++: int main() { const int
Given the following code (partial), write a function definitions using pointer notation, and also call function in main using c++:
int main()
{
const int SIZE = 4;
double a[SIZE] = {1,2,3,4};
double *ptr;
ptr = a;
//call the calculateSum function using ptr here and display the sum
return 0;
}
// define calculateSum function here use pointer notation. The function should calculate and return the sum of the array, the function should also accept a pointer as input parameter. Use const keyword in appropriate places.
double calculateSum(_______________________________)
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
