To change the code to pass-by-reference instead of pass-by-pointer you need to change * to & in the function parameters, and within the function use the variables as if they were local, so instead of
*numSmallerThanAverage = 27;
as you would with pointers, you just write this instead:
numSmallerThanAverage = 27;
This will work for the two scalars. Have a look at to see how to pass an array by reference.