C language arrangement

Source: Internet
Author: User

// Const modifies the variable and treats the variable as a constant. It can only be read but not written.

// The const modifier is immutable.

Const Int* P = &;// Const modifier * P. The pointer Variable P cannot be used to modify the content pointing to the space, but P can be repeated.


Int Const* P1 = &;// Const modifier * P1. the pointer Variable P cannot be used to modify the content pointing to the space, but P can be repointed to. (The permission to modify the content pointing to the space through * P1 is limited)

Int*ConstP2 = &;// Const modifies P2. P2 cannot be repointed, but can be used to modify the content pointing to a space. (The address stored in P2 cannot be changed, but the address stored in P2 can be used to modify the content of the space pointed to by the address)

Const Int*ConstP3 = &;// The const modifier P3 and * P3, P3 cannot be re-directed, or * P3 can be used to modify the content pointing to the space.

// Const ensures program security.


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.