Several details about C Language

Source: Internet
Author: User

1 sizeof is not a function, but an operator.

 

2. When parsing, the compiler ignores the type name, And the const is near to the person Who modifies the person.

Const int * P; // P variable. The object pointed to by P cannot be changed.

Int const * P; // P variable. The object pointed to by P cannot be changed.

Int * const P; // P is unchangeable, and the object pointed to by P is variable.

Const int * const P; // the pointer P and P point to the object are not changeable

 

3Puts () is applicable when the output content does not include variables or constants, instead of the printf function.

4 The volatile keyword is a type modifier. The type variables it declares can be changed by unknown factors in some compilers, such as operating systems, hardware, or other threads. When the variable declared by this keyword is met, the compilerCodeSo as to provide stable access to special addresses. Example of using this keyword: int volatile nvint when the value of the variable declared by volatile is required, the system always reads data from its memory again, even if the previous command reads data from this place.

generally, volatile is used in the following places: volatile must be added to the variable modified in the interrupt service Program for other programs to detect ;, volatile should be added to the labels shared by all tasks in a multi-task environment. Volatile is also required for the hardware registers mapped to memory, because each read/write to it may have different meanings;

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.