Const, static, extern usage summary, constextern
Const application:
1. For the basic declaration const int r = 100; // standard const variable declaration and initialization, the compiler will directly replace it with 100 during compilation after
Analysis on the usage of http://www.cnblogs.com/rollenholt/archive/2012/03/20/2409046.htmlextern "C"
1.
IntroductionC ++ language was originally created as "a better C ", however, this does not mean that the compilation and connection methods used
One, the use of extern method
The following is an explanation of extern in the C language program:
In all source files of a source program, an external variable can only be defined once in a file, and other files are accessed through an extern
1. Declaring external variables
Modern compilers are generally compiled by file, so at compile time, the global variables defined in each file are
Transparent to each other, that is, at compile time, the visible domain of the global variable is
1. Basic explanationExternIt can be placed before a variable or function to indicate that the definition of a variable or function is in another file, prompting the compiler to find its definition in other modules when it encounters this variable
1 Basic explanation:extern can be placed before a variable or function to mark the definition of a variable or function in another file, prompting the compiler to find its definition in other modules when it encounters this variable and function.
The attributes of variables and functions include the data type and data storage class. The storage class index data is stored in memory (static and dynamic), including auto, static, register, and extern.
Memory. Specifically, memory is divided
Extern usage and extern usage
In C, the modifier extern is used before the declaration of a variable or function to indicate that "this variable/function is defined elsewhere and must be referenced here ". (Extern can be placed before a variable or
Knowledge Points:External functions: Defined functions can be accessed by this file and other files1> all functions are external functions by default2> external functions with the same name are not allowedIntrinsic functions: Defined functions can
Transfer from chao_yu,cnblog.com1 Basic explanation : extern can be placed before a variable or function to indicate the definition of a variable or function in another file, prompting the compiler to find its definition in other modules when
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.