Can someone please walk through this program for me and explainout the outputs are generated.
#include
#include
using namespace std;
const int size = 5;
int fun(int arz[size], int jump)
{
int i, j = 0;
for(i = 0; i < size; i += jump)
j += arz[i];
return j;
}
main()
{
int arx[size] = {1, 2, 4, 8, 16};
int ary[size] = {10, 20, 40, 80, 160};
cout << fun(arx, 1) << endl;
cout << fun(ary, 2) << endl;
cout << fun(arx, 3) << endl;
cout << fun(ary, 4) << endl;
cout << fun(arx, 5) << endl;
cout << fun(ary, 6) << endl;
} // main