0

I want to know what is the difference between these two statements in C. Are they same? Any logical proof whether they are same or not.

if (!(b[i]&&c[i+1]&&c[i+2]&&d[i+3]))

and:

if (((b[i] == 0|| c[i+1] == 0)|| c[i+2] == 0)|| d[i+3] == 0)
4

2 回答 2

4

是的,他们都会评估相同的结果。

如果其中任何一个值0大于表达式将返回 true 并输入 if 语句(除了最后缺少的括号)

就证明而言,这或多或少是德摩根定律

http://www.seas.upenn.edu/~ese570/Boolean_Identities.pdf

于 2013-06-13T19:54:14.517 回答
1

他们是一样的!对于一些证据,您可以阅读有关德摩根定律的信息

于 2013-06-13T20:00:22.500 回答