Create the logic for a program whose main() method prompts a user for 1000 numbers and stores them in an array.

Pass the array to a method that reverses the order of the numbers.
In the main() method, display the numbers.

1 answer

Try something like this:

main() {
int x[1000],y[1000],i;
for (i=0;i<1000;i++) {read x[i]}
y = rev(x,1000);
for (i=0;i<1000;i++) {printf("%d ",x[i]}
}

int *rev(*int,n) {
int y[1000],i;
for (i=0,n--;i<1000;i++,n--) {y[i] = x[n-i];
return y;
}