Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

passing array to the function c++

double getAverage(int arr[], int size) {
  int i, sum = 0;       
  double avg;          

   for (i = 0; i < size; ++i) {
      sum += arr[i];
   }
   avg = double(sum) / size;

   return avg;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #passing #array #function
ADD COMMENT
Topic
Name
9+6 =