Purpose of @ Symbol Before Strings?

前端 未结 1 1572
遇见更好的自我
遇见更好的自我 2020-11-30 14:49

I\'ve been using Objective-C for a while now, but have never really understood what the purpose of the @ symbol before all strings is. For instance, why do you have to decla

相关标签:
1条回答
  • 2020-11-30 15:45

    It denotes a NSString (rather than a standard C string)

    an NSString is an Object that stores a unicode string and provides a bunch of method to assist with manipulating.

    a C string is just a \0 terminated bunch of characters (bytes).

    EDIT: and the good reason is that Objective-C builds on top of C, the C language constructs need to be still available. @"" is an objective-c only extension.

    0 讨论(0)
提交回复
热议问题