* ptr ++和++ * ptr之间的区别? [英] difference between *ptr++ and ++*ptr ?

查看:143
本文介绍了* ptr ++和++ * ptr之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


有人可以解释我之间的区别:

* ptr ++和++ * ptr


非常感谢..


杰森。

解决方案

Jason写道:

你好,

有人可以解释我之间的区别:
* ptr ++和++ * ptr




* ptr ++表示获取'ptr'指向的东西,并且

增加'ptr''所以它指向下一个东西。


++ * ptr表示递增东西`ptr''指向,并且

让`ptr''本身保持不变。


-
Er*********@sun.com


Eric Sosman写道:

Jason写道:

你好,

可以有人解释了我之间的区别:
* ptr ++和++ * ptr

* ptr ++表示获取'ptr'指向的东西,并且
增加'ptr''所以它指向下一个东西。

++ * ptr意味着增加东西`ptr''指向,并且
让'ptr''本身保持不变。




即使你不记得

优先规则或评估顺序,第二个表达也是明确的。当谈到第一个

表达式时,我会在单独的声明中增加ptr(尽管大多数C

程序员喜欢多种副作用)。

- 八月


2005年5月15日星期日,格林尼治标准时间15:09:49,8月卡尔斯特罗姆

< fu ** ******@comhem.se>写道:

Eric Sosman写道:

Jason写道:

你好,
有人可以解释我之间的区别:
* ptr ++和++ * ptr



* ptr ++表示获取'ptr'指向的东西,并且
增加`ptr''所以它指向下一个东西。

++ * ptr意味着增加东西`ptr''指向,并且
离开`ptr''本身没有变化。



即使你不记得
优先规则或评估顺序,第二个表达也是明确的。说到第一个
表达式,我会在单独的声明中增加ptr(尽管大多数C
程序员喜欢多种副作用)。

- 八月




好​​的 - 谢谢你的回答


Jason.S。


Hello,

could someone explain the difference to me inbetween:
*ptr++ and ++*ptr

Thankx a lot..

Jason.

解决方案

Jason wrote:

Hello,

could someone explain the difference to me inbetween:
*ptr++ and ++*ptr



*ptr++ means "Fetch the thing that `ptr'' points to, and
increment `ptr'' so it points to the next thing."

++*ptr means "Increment the thing `ptr'' points to, and
leave `ptr'' itself unchanged."

--
Er*********@sun.com


Eric Sosman wrote:

Jason wrote:

Hello,

could someone explain the difference to me inbetween:
*ptr++ and ++*ptr


*ptr++ means "Fetch the thing that `ptr'' points to, and
increment `ptr'' so it points to the next thing."

++*ptr means "Increment the thing `ptr'' points to, and
leave `ptr'' itself unchanged."



The second expression is unambiguous even if you don''t remember the
precedence rules or evaluation order. When it comes to the first
expression I''d increment ptr in a separate statement (even though most C
programmers love multiple side-effects).
-- August


On Sun, 15 May 2005 15:09:49 GMT, August Karlstrom
<fu********@comhem.se> wrote:

Eric Sosman wrote:

Jason wrote:

Hello,

could someone explain the difference to me inbetween:
*ptr++ and ++*ptr


*ptr++ means "Fetch the thing that `ptr'' points to, and
increment `ptr'' so it points to the next thing."

++*ptr means "Increment the thing `ptr'' points to, and
leave `ptr'' itself unchanged."



The second expression is unambiguous even if you don''t remember the
precedence rules or evaluation order. When it comes to the first
expression I''d increment ptr in a separate statement (even though most C
programmers love multiple side-effects).

-- August



Ok - Thank you for the answers

Jason.S.


这篇关于* ptr ++和++ * ptr之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆