Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write a function s(a, n), where a is a one-dimensional integer array and n is the length of the array, and find the average value in the array through the pointer.
Write a function s(a, n), where a is a one-dimensional integer array and n is the length of the array, and find the average value in the array through the pointer.
Double s(int* a, int n)

{

int i,avg = 0;

for(I = 0; I & ltn;; i++)

avg+= a[I];

return(double)avg/(n * 1.0);

}