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;
}
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.
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.
你有一个局部变量,并具有相同名称的函数reload
You have a local variable in main
called reload
which hides the function. Rename your local variable and you should be fine
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.