Priority of C/C ++ statements

Source: Internet
Author: User

Rules declared by C/C ++:

Steps:

1. Declare to read data starting from the name and then read data in order of priority.

2. The priority order is:

(1) Parts enclosed in parentheses in the statement

(2) Suffix operator. brackets () indicate a function. square brackets [] indicate an array.

(3) prefix operator *, indicating "pointer"

3. If the const and volatile keywords are placed before the type identifier, it acts on the type operator, for example, "pointer to the int type const variable" (const int * P ). Generally, it should be placed on the right of *, for example: int * const P; indicates that p is the const pointer to the int type object.

Example:

Char * const * (* Next )();

Analysis:

1. "Next" is a whole in brackets, indicating that "Next" is a pointer "---".

2.2 outside the brackets, the suffix operator is (), and next points to a function, that is, "Next is a pointer, which points to a function that returns ---"

2.3. The prefix operator * indicates that the function returns a pointer.

3. interpret char * const as a const pointer to char type.

Therefore, according to the above analysis, it can be obtained that "next is a pointer pointing to a function. This function returns another pointer, which returns a const pointer pointing to the char type".

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.