search

Home  >  Q&A  >  body text

iOS中定义常量字符串的问题

有个问题比较疑惑,定义常量字符串的问题,以下代码:
NSString * const kSomeConstantString = @"";
const NSString * kSomeConstantString = @"";有何区别?

大家讲道理大家讲道理2919 days ago728

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-17 12:03:25

    const type * variable name: you can change the pointer’s pointer, but you cannot change the content pointed to by the pointer.
    Type * const variable name: The content pointed to by the pointer can be changed, but the pointing of the pointer cannot be changed.
    Reference address

    reply
    0
  • 阿神

    阿神2017-04-17 12:03:25

    C language knowledge- - const NSString* const string;

    reply
    0
  • Cancelreply