[002] Primary knowledge pointer

Source: Internet
Author: User

Pointers (pointer) and references implement indirect access to other objects, but unlike references, the pointer itself is an object and does not need to be assigned an initial value when defined. Define pointers in the form of *p.

1 int val, *p2;       // Val is an int type object, p2 is a pointer to an int object

Because the pointer holds the address of the object, you need to use the Fetch address character (&) to get the address.

1 int 1024x768 ; 2 int *pval = &val;        // PVal is a pointer to the Val of the variable

Similar to a reference, in most cases, the type of the pointer is strictly matched to the object it points to.

Not finished.

[002] Primary knowledge pointer

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.