开发者

Objective C - Difference Between VARType* vt and VARType *vt [duplicate]

开发者 https://www.devze.com 2023-03-11 22:48 出处:网络
This question already has answers here: 开发者_JS百科 Closed 11 years ago. Possible Duplicate: Placement of the asterisk in Objective-C
This question already has answers here: 开发者_JS百科 Closed 11 years ago.

Possible Duplicate:

Placement of the asterisk in Objective-C

What is the differenct between the following:

(Assume we have a class calculator)

Calculator* calc;
Calculator *calc;

Also what is the need for pointers? Is it not possible to omit the star?


There is no difference between those two declarations, you could also do Calculator * calc if you're feeling adventurous.

As far as if you can omit the star, no, you cannot. It is a carry over from C and shows that calc is a pointer to a Calculator, and not a Calculator itself.


There is no difference between the 2 declaration is just an preference for typing. Every thing on computers uses pointers. You need pointers java, c#, etc use pointers. No is not posible to omit the star.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号