Please let me preface this question by stating that I am an absolute C++ novice and I'm only well-versed in R. Also, I'm working within Xcode.
Let's say I create an int object called 'answers'. Initially, it is set as int. After I assign values to answers[0], answers[1], etc., is it still int or has it become something else because I added multiple values?
int answers[4]; answers[0] = 8; answers[1] = 6; answers[2] = 7; answers[3] = 5;
Let's say I want to pass 'answers' to a user-defined function (see code below). My problem is that in the line, cout<<"The first value you entered...", I get an error saying that 'Subscripted value is not an array, pointer, or vector". Then, in the line, showAnswers(answers);, I get the error 'No matching function for call to 'showAnswers''. What am I doing wrong here? My first guess is that 'answers' is no longer an int, but I don't know what it would be.
void playGame(int input){
cout << "The first value you entered was: " << input[0];
}
int main() {
int answers[4];
answers[0] = 8;
answers[1] = 6;
answers[2] = 7;
answers[3] = 5;
showAnswers(answers);
}