Pointer pointer function pointer array

Source: Internet
Author: User

The analysis principle of pointer variables: from the variable name, according to the operator priority combination, step-by-step analysis. ( the parentheses should be removed from the beginning of p )

Pointer, point to what (x), X is what type of

Int *p; First, starting from P, first with *, that P is a pointer, and then combined with an int, indicating that the pointer points to the type int, so p is a pointer back to the shaping data

Int *p[3]; First starting from P, first with [] so that P is an array, and then combined with the *, that the elements in the array is a pointer type, and then combined with int, indicating that the pointer to the content type is shaped, so, p is a pointer to return the shape of the array of data;

Int (*P) [3]; First, starting from P, first with the *, that P is a pointer, and then combined with [], that the pointer to the content is an array, and then combined with int, that the elements in the array is shaped, so p is a pointer to an array of shaping data;

int p (int); First, starting from P, first with (), that p is a function , and then enter () in the analysis, the function has a shape variable parameters, and then with the outer int, indicating that the function return value is a shaping data;

Int (*p) (int); First, starting from P, first with the pointer, that P is a pointer, and then combined with (), indicating that the pointer points to a function, and then in () with the int, that the function has an int parameter, and then the outermost int, the function return value type int, so p is a A pointer to a function that has an shaping parameter and returns a type that is shaped.

A pointer is a special variable, and the number stored in it is interpreted as an address in memory. To figure out a pointer requires four aspects of the pointer: the memory area of the pointer itself, the value of the pointer, the memory area that the pointer is pointing to, the type of the pointer, and the type that the pointer points to.

Pointer pointer function pointer 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.