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"; //会报错
网友评论