+ 1

How do I fix the "too many arguments to function" error?

I just began to learn how functions work but can't understand very well the issue that I currently have with my code now. #include <iostream> using namespace std; int sumFunction(); int main () { cout << sumFunction(1); return 0; } int sumFunction(int a) { int y = a + 1; return (y); } I keep getting an error message saying "too many arguments to function 'int sumFunction () ' ."

10th Sep 2018, 2:25 AM
Andy Cruz
Andy Cruz - avatar
1 Respuesta
+ 4
The prototype must have the same signature as the implementation. int sumFunction(); -> int sumFunction(int);
10th Sep 2018, 2:35 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar