You’re very close. Hope this helps.
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int numbers[5];
/* Get size of array */
int size = sizeof(numbers)/sizeof(int);
int val;
for(int i = 0; i < size; i++) {
cout << "Enter a number: ";
cin >> val;
numbers[i] = val;
}
/* Start index at spot 4 and decrement until k hits 0 */
for(int k = size-1; k >= 0; k--) {
cout << numbers[k] << " ";
}
cout << endl;
return 0;
}
1
solved how to print an array backwards