It's easy enough to print numbers in reverse.
Just go
Code:
for(i=N-1;i>=0;i--)
printf("%d\n", array[i]);
But you're not allowed to do this. You have to reverse the array. So you have to step throuhg half of it, swapping very ith element with the N-i-1th element. It's a bit tricky to get all the cases right.
To generate random number on 0 to N-1, the cheap and nasty way is rand() % N. This doesn't give a very good distribution, because rand() isn't truly random and the lower bits are less random than the whole.
So the best way to to say
Code:
/* random number on 0-1 minus a tiny epsilon */
#define uniform() (rand()/RAND_MAX+1.0))
/* random number on 0-N */
#define rnd(N) (int) (uniform() * (N))