double getAverages(int nums[]) { double aver = 0.0; int i; for (i = 0; i < 10; i++) { aver += nums[i]; } return aver / 10; } int main(void) { /* all variables must be declared at the top of a function */ int i; /* we can declare arrays on the stack, as long as we know their size ahead of time */ int numbers[10]; double ave; printf("Enter 10 numbers: "); for (i = 0; i <10; i++) { /* what's the '&' about? This is how we indicate the address of numbers[i], rather than the value stored there. What about the "%d"? That indicates that we want to read the next thing in as an integer. */ scanf("%d", &numbers[i]); } /* notice no object or class preceding the function call */ ave = getAverages(numbers); /* %lf indicates that we want to print out ave as a double (long float) */ printf("average: %lf", ave); }