pre /后递增指针 [英] pre/post increment pointer

查看:100
本文介绍了pre /后递增指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两位前pressions之间的差异:

Is there a difference between the two expressions:

(*x)++

++(*x)

我可以看到* X这两个语句替换(* X + 1)的内容。但它们之间有什么区别?

I can see both of these statements replace the contents of (*x+1) in *x. But are there any differences between them?

推荐答案

一个递增存储在 X 在使用前的($值p $ p),而其他的以后做它的 的使用它(后)。

One increments the values stored in x before it is used (pre), while the other does it after it is used (post).

另外请注意, ++(* X)是的的一样(* X + 1)。第一递增值,并存储回,另一只递增值

Also note that ++(*x) is not the same as (*x + 1). The first increments the value and stores it back, the other just increments the value.

这篇关于pre /后递增指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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