Constant pointer and constant pointer to a constant and to a constant

Source: Internet
Author: User

(1) pointer to a constant: A pointer variable pointing to a constant. Const int * P = & X; * P content cannot be modified, however, the pointer P can point to another address, which is the same as int const * P.

(2) constant pointer: int * const P = & X pointer itself is a constant, fixed to a variable, so P is not variable, but * P is variable

(3) A constant pointer to a constant: const int * const P = & X. The pointer P always points to X and cannot be used to modify the content of the address it points.

Constant pointer and constant pointer to a constant and to a constant

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.