C语言中静态函数的用途是什么? [英] What is the use of static functions in C lang?

查看:564
本文介绍了C语言中静态函数的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

c lang中静态函数的用途是什么?它如何对我们的

程序有用?

plz帮助我。

Hi friend,

what is the use of static functions in c lang? How it can useful to our
programs?
plz help me.

推荐答案



" sabarish" <苏****** @ gmail.com>在消息中写道

news:11 ********************* @ f14g2000cwb.googlegro ups.com ...

"sabarish" <su******@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
朋友,

在c lang中使用静态函数有什么用?它如何对我们的
程序有用?
PLZ帮助我。
Hi friend,

what is the use of static functions in c lang? How it can useful to our
programs?
plz help me.




查看你已经得到的答案。

-Mike



See the answers you already got.

-Mike


2005年11月11日10:43:15 -0800,在comp.lang.c,sabarish

< su ****** @ gmail.com>写道:
On 11 Nov 2005 10:43:15 -0800, in comp.lang.c , "sabarish"
<su******@gmail.com> wrote:
你好朋友,

在朗格中使用静态函数有什么用?它对我们的
程序有用吗?
Hi friend,

what is the use of static functions in c lang? How it can useful to our
programs?




" static"将函数的范围限制为当前文件。用

换句话说,你不能从代码的另一部分看到它。


这对于保护应该是私有的操作很有用。 br />
-

马克麦金太尔

CLC常见问题< http://www.eskimo.com/~scs/C-faq/top。 html>

CLC自述文件:< http://www.ungerhu.com/jxh/clc.welcome.txt>


---- = =通过Newsfeeds.Com发布 - 无限制 - 无限制安全Usenet新闻== ----
http://www.newsfeeds.com 世界排名第一的新闻组服务! 120,000多个新闻组

---- =东和西海岸服务器农场 - 通过加密的总隐私= ----



"static" restricts the scope of the function to the current file. In
other words, you can''t see it from another part of your code.

This is useful for protecting operations which should be private.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


它是建议将所有私有函数声明为静态。

使用''static'',其他人可以乍一看该函数是一个

私有函数 - 仅用于同一文件中的其他函数,但

不是其他文件中的函数。将.c文件视为

实现和相应的.h文件作为接口,

程序员将.c中的私有函数和.h中的公共

函数原型化。当然,两种类型的

函数的定义都在.c文件中。

It is recommended that all private functions be declared as static.
With ''static'', others can tell at first sight that the function is a
private function - used only by other functions in the same file, but
not by functions in other files. Considering the .c file as an
"implementation" and the corresponding .h file as an "interface", the
programmer prototypes the private functions in the .c and the public
functions in the .h. Of course the definitions of both types of
functions are in the .c file.


这篇关于C语言中静态函数的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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