C language self-study-1

Source: Internet
Author: User

Let's take a look at the basic things that have not been mastered. I'm glad to have such a leisurely time. You can learn the C language again.

<1> const char * variable. A pointer to a constant can point to a constant, but it cannot be used to change the value of the indicated object.

<2> # The symbols defined in define are replaced directly.

<3> the content of the volatile variable is described inProgramChanges at any time when unknown.

The volatile variable is variable, allowing users to modify other content than programs, such as hardware.

Access to the data will directly access the content of the address at any time, that is, the optimization of the access speed through the cache is canceled.

For example, if the terminal of the hardware device changes it, the hardware device usually has its own private memory address, such as the video memory.

Generally, they are reflected in a specific memory address through an image.

In this way, under some conditions, the program can directly access these private memory.

In addition, for example, when multiple programs operate on the shared memory address

Your program does not know when the memory will be changed

Without the volatile modification, the program uses the data in the cache, which may be outdated.

With the volatile modifier, the program re-extracts the address when needed to ensure that it is up to date.

For example, transfer the address of the global variable to the clock subroutine of the operating system, and use the global variable to save the real-time clock value of the system.

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.