static extern volatile

Source: Internet
Author: User

Static

Role:1, Internal link assignment (limit global variables or functions to be available within this file)

2. Change the life cycle of local variables (so that local variables are stored in the static zone and released at the end of the program)

3. When defining a variable, add the static prefix, and the defined variable is initialized to 0 by default;


extern:1. Specify external links (make global variables or functions available within other files)

2. Tell the compiler that variables or functions declared by extern are within other files)

3, we know that if within a file if a global variable and a local variable name is the same, then in the local variable within the code block, we prefer to use local variables, but after the addition of extern is represented by the global variable.


Volatile: generally used with const, for example: int const a=10;

Because the const is added, the compiler will "optimize" A as a constant and store a on the stack. volatile int const a=10, plus volatile, tells the compiler not to optimize a for constants, so a can be modified in this case.


This article is from the "11132019" blog, please be sure to keep this source http://11142019.blog.51cto.com/11132019/1760087

static extern volatile

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.