C 奇怪的 if 语句语法

标签 c if-statement

我看到了这个if声明,我不确定它到底是如何工作的,什么与什么进行比较?是否缺少&&|| ? parent 让我很困惑。

if ((list->func)((list->head)->dataPointer, newOb) < 0) {

最佳答案

what is being compared with what? The parens are confusing me.

if() 之间部分的结果与 0 进行比较,就像每个 if 语句一样。

Is there a lack of && or ||?

我没有看到任何 && 或 ||

The parens are confusing me.

(list->func)((list->head)->dataPointer, newOb) 的作用是(不一定按此顺序):

  • 评估list->func
  • 评估(list->head)->dataPointer
  • 调用 list->func 传递两个参数 (list->head)->dataPointernewOb >.

然后将其结果与 0 进行比较,因为它位于 if() 之间。

关于C 奇怪的 if 语句语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40372496/

相关文章:

c++ - 输出小数点后的两位数

c++ - 无法使用 Microsoft Visual Studio C++ 2008 速成版编译 C 代码

java - 确定范围是否重叠

python - 我无法正确跟踪 PyGame 中的 KEYDOWN 事件

c++ - 输入为高值时程序崩溃

c - 为什么结果总是/254?

c++ - "static"在 C 和 C++ 中表示没有外部链接的函数/变量是怎么发生的?

c++ - while循环if和else

c++ - 为什么我的 if-else 语句会流向第三个 else?

c - 如何在C程序中用汇编语言编写while循环\if语句?