Reputation: 7338
I have this code, but when I compile it with Borland Turbo C++, Turbo C++ say:
Error filename.cpp 13: Call of nonfunction in function main()
my code is:
#include <iostream.h>
int reload (int yes, int no) {
int reload;
cout << yes << no;
cin >> reload;
return reload;
}
main () {
int a, reload = 1;
while (reload == 1) {
reload (1,0);
cout << "Enter a number: ";
cin >> a;
}
return 0;
}
Upvotes: 0
Views: 392
Reputation: 5582
You have a local variable and a function with the same name reload
Upvotes: 1
Reputation: 133004
You have a local variable in main
called reload
which hides the function. Rename your local variable and you should be fine
Upvotes: 0
Reputation: 114725
You have a int
reload variable in main that hides the reload function. You don't overload resolution between variables and functions only between different functions.
Upvotes: 1
Reputation: 361615
int a, av = 1, reload = 1;
You named a variable reload
which hides the reload()
function. The compiler thinks you are trying to "call" the int reload
variable, thus "call of nonfunction".
Rename either the function or the variable.
Upvotes: 6