头发尚存的猿小二 2022-09-16 23:16 采纳率: 100%
浏览 37
已结题

C语言运算顺序能不能根据下图解释一下

img


能不能解释一下下图的运算顺序,我有点不懂,下图是跑出来的值。

  • 写回答

1条回答 默认 最新

  • _GX_ 2022-09-16 23:45
    关注

    别写这种代码,深究也没有意义。
    C/C++标准中没有规定运算符的两个操作数的计算顺序,因此编译器可以按照任意顺序来计算操作数,这就导致了你上面写的代码在不同编译器上得到的结果可能不一样。
    https://en.cppreference.com/w/c/language/eval_order

    Order of evaluation of the operands of any C operator, including the order of evaluation of function arguments in a function-call expression, and the order of evaluation of the subexpressions within any expression is unspecified (except where noted below). The compiler will evaluate them in any order, and may choose another order when the same expression is evaluated again.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 12月29日
  • 已采纳回答 12月21日
  • 创建了问题 9月16日

悬赏问题

  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面