Why wont this work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why wont this work?

This pequeno piece of code wont run coz I made "too many arguments to function 'int printSomething2()'". where did I go wrong? #include <iostream> using namespace std; void printSomething(); int printSomething2(); int main(){ printSomething(); cout << printSomething2(9.95); return 0; } void printSomething(){ cout << "Print this statement to the screen!\n"; } int printSomething2(float a){ a + 13; } https://code.sololearn.com/c92x8c7UxiLm/?ref=app

12th Nov 2019, 12:02 PM
Hilary
Hilary - avatar
2 Answers
+ 3
In the prototype of printSomething2(), you declare it without a parameter. The function also doesn't return a value which may results undefined behavior.
12th Nov 2019, 12:14 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForie thanks, I never paid attention to declaration of the prototype...
12th Nov 2019, 12:19 PM
Hilary
Hilary - avatar