可以在外部引用(调用)C文件中定义的静态函数吗? [英] Can a static function defined in a C file be ever referred (called) externally ?

查看:185
本文介绍了可以在外部引用(调用)C文件中定义的静态函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C文件中定义的静态函数是否可以从另一个C文件外部引用(调用)

?如果是,在哪种条件下?

Can a static function defined in a C file be ever referred (called)
externally from another C file?If so in which conditions?

推荐答案

只有当您包含文件(其中定义了静态函数)时才会在另一个C文件中使用另一个C文件(您要在其中使用)

only when you include the file(in which static function is defined) in
another C file(in which you want to use)


jeniffer认为:
jeniffer opined:
C文件中定义的静态函数是否可以被引用(称为)
从另一个C文件外部?如果是这样的话?
Can a static function defined in a C file be ever referred (called)
externally from another C file?If so in which conditions?




是的,如果你声明一个变量是这个函数的指针,并且

使它指向该函数(显然这必须在

文件中完成,其中`static`函数是)。如果该指针不是静态的,那么可以从其他地方使用它来调用该函数。


如果你想到函数/ names /,它会有所帮助,他们无法进入。


-

BR,Vladimir


INTOXICATED:

当你觉得复杂而不能发音时。



Yes, if you declare a variable to be a pointer to such a function, and
make it point to that function (obviously this has to be done in the
file where `static` function is). If that pointer is not static, it
can be used from elsewhere to call that function.

It may help if you think of function /names/, they''re not accessible.

--
BR, Vladimir

INTOXICATED:
When you feel sophisticated without being able to pronounce it.


ji ************ @ gmail.com 认为:
ji************@gmail.com opined:
仅当您包含文件(其中定义了静态函数)
在另一个C文件中(你想在其中使用)
only when you include the file(in which static function is defined)
in another C file(in which you want to use)




你在说什么?你在跟谁说话?阅读:


< http://cfaj.freeshell.org/google/>

< http://clc-wiki.net/ wiki / Introduction_to_comp.lang.c>


另外,你的回答是错误的。将文件包含到另一个文件中会使其成为该文件的一部分,因此与原始问题无关。请参阅

我的其他帖子以获得正确的答案。


-

BR,Vladimir


我不知道第三次世界大战会用什么武器进行战斗,但是世界

第四次世界大战将用棍棒和石头进行战斗。

- - 阿尔伯特爱因斯坦



What are you talking about? Who are you talking to? Read:

<http://cfaj.freeshell.org/google/>
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Also, your answer is wrong. Including a file into another makes it a
part of that file, and thus irrelevant to the original question. See
my other post for the correct answer.

--
BR, Vladimir

"I know not with what weapons World War III will be fought, but World
War IV will be fought with sticks and stones."
-- Albert Einstein


这篇关于可以在外部引用(调用)C文件中定义的静态函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆