Alright, I'm in an intro course and we have to use the following prototype in a little betting game.
bool PlayAgain (void)
How would one go about returning a boolean value with this prototype? The function that I have created is very basic as I am just trying to make everything work before I go into the details.
The compiler shows that it returns "tf" as true of false but does not store it in anything. How do I store it in something? Any time I type something into the call in the main function, the compiler tells me there are too many arguments.
Ex
1 2 3 4 5 6
PlayAgain (playAgain);
//Compiler says there are too many function calls
PlayAgain ();
//Works but does not let value of bool
//to be stored
Don't let the void throw you off. It's just some way that some programmers like to show that a function takes no arguments - In C++ anyways. It means something else in C. It has to do with making the two interpretations across languages play friendly.
To "store" the value returned by the PlayAgain function, you need to assign it to a variable.