What’s the value of i++ + i++?

What's the value of i++ + i++??

It's undefined. Basically, in C and C++, if you read a variable twice in an expression where you also write it, the result is undefined. Don't do that. Another example is:

v[i] = i++;

 

Related example:

f(v[i], i++);

 

Here, the result is undefined because the order of evaluation of function arguments are undefined.

原文链接: https://www.cnblogs.com/ai616818/archive/2012/04/26/2471721.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    What's the value of i++ + i++?

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/48587

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月9日 上午12:23
下一篇 2023年2月9日 上午12:24

相关推荐