The function of C language static static variable

Source: Internet
Author: User

The function of C language static static variableStatic


Variable type of C language

    1. Static variables are declared by the keyword static, which is stored on the data segment, which is memory, and can change the scope and life cycle of the variable.
    2. There is still no change to the local variable scope, only the function and compound statement that defines the local variable can be referenced, but its life cycle becomes until the end of the entire source program file.
    3. The global variable life cycle has not changed, but its scope has decreased, only the function of this file can reference the global variable.
    4. For the characteristics of static, only the function in this file can reference the variable, in C language a source program file is a module, a source program file (module) declares a static global variable The other module can only access this static variable through the interface functions provided by the module, and cannot directly implement it, that is, static can implement the encapsulation of a module.

The function of C language static static variable

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.