如果函数(例如a())原型在函数内声明(比如main()),是否意味着它不能用于main()函数以外的函数?
No that does not mean that. If the other functions declare it too, then the function can be used by those other functions too.
int main(void) {
void f(void);
f();
}
void g(void) {
void f(void);
f();
}
In this example, main
declared function f
locally and called it. But g
does that same thing too. Both declarations refer to the same function.
Yes that is correct. That is true for all declarations within a particular scope. They are only available within the defining scope.
Of course, you can declare the same function in another scope, but I don't think that's what you meant.
通常,您能够在函数内声明的内容(例如变量)仅用于该函数。
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.