Let's forget about the second question for now and worry about the first one.
and a one-dimensional real array
C doesn't have a 'real' type.
The program should then find and should output the values that are above the average of the array values.
Well, the first thing you'd need to do is figure out the average of all the elements in the array. Write a function that does exactly that and store its return value in an object of the same base type of the array you're using. Then write a function that emits only the numbers that are greater than that value.
One thing you'd need to think about is how you're going to initialise the elements of the array, the test question doesn't specify that so you'd need further clarification (and get the damn type right too). Frankly, I wouldn't worry about any of that for now and just hard-code an array of doubles, like so:
Code:
const double f[] = { 12.3, 41.2 10.2, 1.4, 0, 21, 40.5 };
Then write two functions with the following prototypes:
Code:
double average(const double *ptr, size_t nelems);
void print(const double *ptr, size_t nelems, double threshold);
Though, I'd say the test question is horribly brief and that you'd be better off learning C from a reference like K&R2. Anyway, have fun.