【发布时间】:2011-11-09 22:19:02
【问题描述】:
可能重复:
Declaring pointers; asterisk on the left or right of the space between the type and name?
Does it matter where I place the asterisk when declaring pointers in C++?
我进行了搜索,但我的关键字似乎不合适。我很确定这个问题已经被问过了。如果您知道链接或其他内容,请指出我的方向!
我的问题是,为什么这么多人使用
TypeIdentifier *varname;
代替
TypeIdentifier* varname;
这对我来说更合乎逻辑,因为 * 修改了类型而不是变量名。
【问题讨论】:
-
请在提出新问题之前使用搜索 - 这已经被问及回答了 无数次 次。
-
伙计,我必须训练我的关键字技巧。感谢您的链接。 @mekici 是的,确实如此。嗯,我愿意。有时真的让我很困惑,我必须仔细看看这个变量到底是什么类型。
-
Stroustrup 推荐
Type* name而不是Type *name