什么是用C静态和extern之间的区别? [英] What is the difference between STATIC and EXTERN in C?

查看:212
本文介绍了什么是用C静态和extern之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  静态VS的extern“ C”的

是什么区别静态的extern 用C?

推荐答案

静态存储类用于声明一个标识符,是一个局部变量或者给一个函数或文件,而且存在并保留了它被宣布在那里控制通行证后的价值。此存储类有一个持续时间是永久的。宣布这一类的变量保留其值从函数的一个调用到下一个。范围是局部的。变量是仅通过其内,或者如果在全球范围内的文件宣称,它仅由该文件中的函数已知或看到声明的功能公知的。这种存储类保证变量的该声明也初始化变量为零或所有位关闭。

"The static storage class is used to declare an identifier that is a local variable either to a function or a file and that exists and retains its value after control passes from where it was declared. This storage class has a duration that is permanent. A variable declared of this class retains its value from one call of the function to the next. The scope is local. A variable is known only by the function it is declared within or if declared globally in a file, it is known or seen only by the functions within that file. This storage class guarantees that declaration of the variable also initializes the variable to zero or all bits off.

的extern 存储类用于声明将已知功能的文件,并能够被称为所有功能于一身的程序的全局变量。此存储类有一个持续时间是永久性的。直到被另一个任务改变了这一类的任何变量将保留其值。范围是全球性的。一个变量可以被称为或程序中的所有功能看到。 。

The extern storage class is used to declare a global variable that will be known to the functions in a file and capable of being known to all functions in a program. This storage class has a duration that is permanent. Any variable of this class retains its value until changed by another assignment. The scope is global. A variable can be known or seen by all functions within a program. ."

摘自:<一href=\"http://wiki.answers.com/Q/What_is_the_difference_between_static_and_extern\">http://wiki.answers.com/Q/What_is_the_difference_between_static_and_extern

这篇关于什么是用C静态和extern之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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