void functions aren't value returning. Therefore, does not need "return;" and "go home" would be outputted even if n was < 99. try an if-else statement
void functions aren't value returning. Therefore, does not need "return;" and "go home" would be outputted even if n was < 99. try an if-else statement
I'm pretty sure you're wrong.
As for the actual question, I doubt it because it could be easily missed.
int yourAnIdiot()
{
int guessWhat = 69;
return GuessWhat;
} // yourAnIdiot value returning function that requires a return statement
int main()
{
int lol;
lol = yourAnIdiot();
if (lol == 69)
{
cout << "You're an idiot" << endl;
}
return 0;
}
@ohmymosh: What are you trying to prove? No, a void function doesn't require a return statement. Yes, you may provide it with one or more anywhere in the code, which will cause the function to return at that point. No, you may not return an actual value, it will just cause the function to return before reaching the end.