开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜