Simple pointer type

Source: Internet
Author: User

Int p; // This is a common integer variable.

Int * p; // start with P and combine with * first, so P is
// Pointer, and then combined with int, it indicates that the Pointer Points
// The content type is int. So P is a return integer.
// Type Data Pointer

Int p [3]; // starts from P and is first combined with [], indicating that P is a number.
// Group, combined with int, indicates that the elements in the array are integers.
// Type, so P is an array composed of Integer Data

Int * p [3]; // starts from P and combines with [] because of its priority.
// It is higher than *, so P is an array and then combined *.
// The element in the array is pointer type, and then combined with int,
// Indicates that the pointer points to an integer type, so
// P is an array composed of pointers that return integer data.

INT (* P) [3]; // starts from P, and is first combined with *, indicating that p is a pointer.
// Then combine with [] (and "()" This step can be ignored, just
// Changed the priority), indicating that the pointer points to
// Array, and then combined with int, the elements in the array are
// Integer. So P is a number that points to an integer.
// Group pointer

Int ** P; // start with P and first combine with *. P is a pointer.
// Combined with *, it indicates that the element pointed to by the pointer is a pointer.
// Combined with int, it indicates that the element pointed to by the pointer is an integer.
// Type data. The second-level pointers and more advanced pointers are rarely used.
// In complex types, we will
// Multi-level pointers are not taken into account. A maximum of first-level pointers are considered.

Int P (INT); // starts from P. It is first combined with (), indicating that p is a function and then enters
// (), Indicating that the function has an integer Variable Parameter
// Then combine it with the int value, indicating that the return value of the function is
// An integer

Int (* p) (int); // starting from P, it is first combined with the pointer, indicating that P is a pointer, and then
// () Indicates that the pointer points to a function and
// Int indicates that the function has an int parameter and
// Int indicates that the return type of the function is integer, so P indicates
// Returns the pointer to a function with an integer parameter and an integer type.

Int * (* p (int) [3]; // It can be skipped first. It is too complicated to read this type.
// Starting from P, it is first combined with (), indicating that P is a function, and then
// In (), combined with int indicates that the function has an integer variable.
// The parameter, and then combine it with the external *, indicating that the function returns
// A pointer, then to the outermost layer, first combined with [], description
// The returned Pointer Points to an array and then combines it *,
// The element in the clear array is a pointer and then combined with int, which indicates
// The content pointed to by the needle is integer data, so P is a parameter
// Round the data and return an array pointing to an integer pointer variable
// Pointer variable function.

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.