Discover difference between scope and lifetime, include the articles, news, trends, analysis and practical advice about difference between scope and lifetime on alibabacloud.com
Translated from Eric lippert's blog, original: http://blogs.msdn.com/ericlippert/archive/2009/08/03/what-s-the-difference-part-two-scope-vs-declaration-space-vs-lifetime.aspx InProgramming LanguageScope is usually the most confusing concept in
The type description of static variables is static. Static variables are of course static storage, but the amount of static storage is not necessarily static variables. For example, although external variables are static storage, they are not
Variable scope
Local scope, global scope, file scope
Local Variables : Also called internal variables, declared within the function (including the main function), the scope begins at the declaration of the variable, ending at the end of the
All variables in C language have their own scopes. The types of declarative variables are different, and their scopes are also different. Variables in C language can be divided into local variables and global variables according to the scope.I.
The difference between a static variable and a global, local variableA static global variable is formed by the description of the global variable (external variable), preceded by static. Global variables themselves are static storage, and static
Class A{int a;//member Variablepublic static void Main (string[] args){int b;//local variable}}————————————————————————————————————————————————————————————————————————————————————————The class body is composed of 2 parts:Part is the definition of
Reprint: http://blog.csdn.net/kevin_darkelf/article/details/11371353Relationships and differences between inheritance, implementation, dependency, association, aggregation, and compositionThese relationships are described separately:InheritedRefers
the difference between static variable and ordinary variable
The description of the global variable (external variable) before being labeled static constitutes a static global variable. The global variable itself is the static storage mode, static
First, the preparation of knowledge-Program memory allocation
The memory used by a program compiled by C + + is divided into the following sections
1, stack area (stack)-by the compiler automatically assigned to release, store the function of the
(1) What is the difference between a static global variable and a normal global variable?(2) What is the difference between static local variable and ordinary local variable?(3) What is the difference between the static function and the normal
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.