// Program 4.7.1
#include using namespace std;double getAverage(int *arr, int size); // function declaration:int main (){int balance[5] = {12, 34, 56, 78, 91}; // an int array with 5 elements.double avg;avg = getAverage( balance, 5 ) ; // pass pointer to the array as an argument.cout < "average="" value="" is:="" "="">< avg="">< endl;="" output="" the="" returned="">return 0;}double getAverage(int *ARRAY1, int size){int i, sum = 0;double avg;for (i = 0; i < size;=""> { sum += ARRAY1[i]; }avg = double(sum) / size;return avg;}TASK1. Explain in details what the program does?2. What is the outputExtracted text: 4.7 Pointer 3 |// Program 4.7.1 #include using namespace std; double getAverage(int *arr, int size); int main () // function declaration: // an int array with 5 elements. int balance[5] = {12, 34, 56, 78, 91}; double avg; avg = getAverage( balance, 5 ); cout « "Average value is: "< avg=""><« endl;="" output="" the="" returned="" value="" pass="" pointer="" to="" the="" array="" as="" an="" argument.="" return="" 0;="" }="" double="" getaverage(int="" "array1,="" int="" size)="" int="" i,="" sum="0;" double="" avg;="" for="" (i="0;" i="">«>< size;="" +ti)="" sum="" +="ARRAY1[i);" avg="double(sum)" size;="" return="">
TASK
1. Explain in details what the program does?
2. What is the output
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here