myArray should be declared as
void smallAverage(int *myArray[], float *average, int *numSmallerThanAverage)
which is a pointer to an array of ints; or
void smallAverage(int **myArray, float *average, int *numSmallerThanAverage)
which is a pointer to a pointer to int; which is the same thing, essentially.
The way you're calling smallAverage is wrong aswell; you want to do
smallAverage(myArray, float* average, int* numSmallerThanAverage)
because you have declared myArray already, and you've also declared smallAverage previously aswell.
So you're trying to figure out the number of numbers which are smaller than
average?
Then you want to fill myArray with numbers; find the median (middle-most number) by dividing the highest value by 2. Doing integer division will truncate the decimal and everything after it, so you want to do that with floats and then convert to an integer. In doing so you will add 0.5 -- if the number is < x.5 it will be truncated to x.0; if it is > x.5 it will be rounded to x + 1; e.g.
1 2 3 4
|
float x = 0.5;
int y = (x + 0.3);
std::cout << y == 1;
|
will be false, because x + 0.3 == 0.8 which will be truncated to 0.
However if you did x + 0.5 == 1.0, y will == 1. If you did x + 0.6 (or higher), y would be truncated to 1 anyway.
Right so at this point you should have the median value; now you want to find the numbers which are smaller than median (which is stored in average). Then you need to add 1 to numSmallerThanAverage (you want to add to the value, not the address/reference by the way) for every value smaller than the median value.
You should have a float* average and int* numSmallerThanAverage in main so that you can print them. Your function should not be printing anything; or it should just not have average and numSmallerThanAverage as parameters because that doesn't make sense.
The point of having pointers as parameters is so that the function can edit them -- that way if you have "float* average" in main and you want smallAverage to change it; it should be passed as a pointer...
In conclusion, your use of pointers as parameters doesn't really make much sense...