C pointers vs. Objective-C pointers

前端 未结 7 1553
醉酒成梦
醉酒成梦 2021-02-06 05:37

I\'m coming from an Objective-C background and am trying to expand my knowledge in C. One thing has me confused, however, and that\'s the difference between pointers in C and O

7条回答
  •  无人及你
    2021-02-06 05:56

    Your NSString *string is itself a pointer. Therefore, in order to point to it, you need to declare stringPointer as a pointer to a pointer. That is, declare stringPointer like this:

    NSString **stringPointer;
    

    Then everything should work. Note that the same pointer semantics apply in C and Objective-C.

提交回复
热议问题