const
2020-05-17 本文已影响0人
自律_自强_通达
NSString *const 和 const NSString * 的区别
-
NSString *const
变量存储的指针可变,变量存储的值不可变
//A modifiable pointer to a constantNSString (its value can't be modified) const NSString * str = @"11"; str = @"22";
-
const NSString *
变量存储的值可变,变量存储的指针不可变
//A constant pointer (not modifiable) to an NSString (its value can be modified) NSString *const str1 = @"33"; str1 = @"44"; //会报错
