头发尚存的猿小二 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 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应