It is necessary to output the elements of the array in reverse order, while passing the last index of the array to the function. What am I doing wrong? Here is my code:
#include <iostream> using namespace std; int Rev(int array[], int len) { if (len < 0) { return 0; } else { array[len]; Rev(array, len-1); cout << array[len] << "\n"; } } int main() { int arr[6] = {42, 23, 16, 15, 8, 4}; // вызов функции Rev(arr, 5); return 0; } At the exit, I get
42 23 16 15 8 4 those. in the same order in which the elements of the array were specified, and I need to output them in reverse order.