Look at the following code and identify what is wrong with it:
void multiply(int, int);
int main() {
std::cout << "The answer is: " << multiply(num1, num2);
}
void multiply(int a, int b) {
return a * b;
}
Prototype is missing variable names
Int parameters should be doubles
Void functions cannot return a value
Value-returning functions must be called in a statement that stores the returned value in a variable
Answer: Void functions cannot return a value.
Comments
Leave a comment