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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!