The use of const in IOS when modifying objects

Source: Internet
Author: User

 /*  ----------const NSString *STR1 = @ "123"--- -------| 0x123456 str---0x654321 | | 123----0x654321 |           The const modifier is *STR, and *str is the value, so the const modifier is the value 123| STR---0x654221 | | Ads----0x654221 | Because the const modifier is a value, the pointer str is also mutable (can point to other values)----------NSString Const *STR2 = @ "456"----------| 0x123464 str2---0x654311 | | 456----0x654311 |           The same as above | STR2---0x654211 | | ZXC----0x654211 | ----------nsstring* Const STR3 = @ "789"----------| 0x123478 STR3---0x654301 | | 789----0x654301 |                              The const modifier is STR3, and STR3 is the pointer (the address that points to the value), |                   ||    | So the const modifier is the value 789 address value | 0x123478 STR3---0x654301 | | Qwe----0x654201 |                              Because the const modifier is the pointer (the address that points to the value) |                   ||    | So the pointer str3 is immutable (cannot point to other addresses)------------------------------------------------------ */ 

The use of const in IOS when modifying objects

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.