Priority rules declared in C Language

Source: Internet
Author: User

the priority rules stated in Expert C Programming (Expert C Programming) are as follows:
A declares that it is read from its name and then read in order of priority.
the priority of B is:
the section enclosed by brackets in B .1 statement;
B .2 suffix OPERATOR: brackets () indicate that this is a function, and square brackets [] indicate that this is an array;
B .3 prefix OPERATOR: asterisk * identifies" pointing ......
C if const and (or) the volatile keyword is followed by the type specifiers (such as int and long), which act on the type specifiers. In other cases, const and (or) the volatile keyword acts on the pointer asterisk next to its left.

example: char * const * (* Next) ();
A next -- next is the declared name
B .1 (* Next) -- next is a point ...... Pointer
B .2 (* Next) () -- next is a function pointer
B .3 * (* Next) () -- next is a function pointer, this function returns a pointer ......
C char * const -- a constant pointer to the character type
SO char * const * (* Next) (); the meaning is: next is a function pointer, which returns a constant pointer to the character type

Let's analyze a statement by ourselves:
int (* Foo () [];
Let's deduce it first and then look at the result: foo is a function that returns a pointer to an integer array. Right? Next let's look at the specific derivation process:
a foo -- foo is the declared name
B .2 Foo () -- foo is a function
B .3 (* Foo () -- foo is a function, which returns a point ...... Pointer
B .2 (* Foo () [] -- foo is a function, which returns a pointer to an array
C int (* Foo ()) [] -- foo is a function that returns a pointer to an integer array.

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.