Pointers on Objective-c

后端 未结 2 1415
日久生厌
日久生厌 2021-01-13 22:24

From what I understand (and please correct me if I\'m wrong):

int x, count = 10;
int *hello;
hello = &count;
x = *hello;

Here the varia

2条回答
  •  天涯浪人
    2021-01-13 22:41

    All the usage of objects in objective c is done through object references, e.g. pointers.

    • The Objective C syntax lets you treat objects without dereferencing them, this is different than C / C++ for that matter.
    • str is an object reference of type NSString (as myFraction) and @"Programming can be a headache" is an object reference of type NSString as well, so you can assign it to str.

提交回复
热议问题