这个代码和你想的结果相反是为什么

#include

using namespace std;

void d(void){
unsigned int a=8;int b = -20;
(a = b>8)?put(">8"):puts("<=8");
}

答案:>8
原因:当表达式中存在有符号类型和无符号类型时所有的操作数都会自动转换成无符号数。

这个代码和你想的结果相反是为什么

相关文章:

  • 2021-09-23
  • 2021-06-29
  • 2021-12-18
  • 2022-12-23
  • 2021-08-31
  • 2021-04-13
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2021-10-09
  • 2021-11-06
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-11
  • 2021-08-14
相关资源
相似解决方案