Here is a smaller program I made but the concept is much the same, what I understand( which is obviously not the case ) with this program is:
The function returnFunc is called 3 times in main
Each time is is called it returns a value from the array
Is the index being reset each time the function returns a value?
#include <iostream>
using namespace std;
main() {
int funcReturn();
cout << "Program should call function which will then return elements in array" << endl;
for(int i = 0; i < 3; i++) {
cout << funcReturn() << endl;
}
}
int funcReturn() {
int a[3] = {33, 44, 55};
for( int i = 0; i < 3; i++) {
return a[i];
}
}