c - 函数调用+计算返回值+比较C中的计算值

标签 c unix if-statement

为模糊的标题道歉,但我只是不知道怎么说。

无论如何,我想要一段代码在一行中(在 if 语句中)做同样的事情

ret= fee(XYZ);
if((fii(ret) && foh(ret)) !=0)
{
  //do something
}

就像把所有的东西都变成类似的东西

if(_______FUM________)    
{
  //do the same thing
 }

有什么我可以做的吗?答案可能是盯着我的脸。但我被困在这里。

最佳答案

您可以使用 comma operator :

if(ret = fee(XYZ), (fii(ret) && foh(ret)) !=0)

但是为什么?!

(此外,!=0 似乎是多余的。)

关于c - 函数调用+计算返回值+比较C中的计算值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19564245/

相关文章:

c++ - 是否使用 if (0) 跳过应该工作的开关中的案例?

python - 简化if语句python

ios - Pass label text from one view controller to another using segues only if button (checkbox) is selected

c - C : remove node function 中的二叉搜索树

c - 堆栈代码无法运行

linux - 从单个列快速创建文件

django - 在 Django 中过滤结果时,如何将 DateTime 对象与 UNIX 时间戳进行比较?

c - 在共享内存中使用结构体的段错误

C输出: Adding a custom filename to a user input directory

windows - 如何在 Windows 上执行类似 "sed -"的操作?