What is &&& operation in C

后端 未结 2 1263
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 09:47
#include 

volatile int i;

int main()
{
    int c;

    for (i = 0; i < 3; i++) 
    {
         c = i &&& i;
         printf(\"%d\\n\"         


        
2条回答
  •  爱一瞬间的悲伤
    2020-12-07 10:39

    It's c = i && (&i);, with the second part being redundant, since &i will never evaluate to false.

    For a user-defined type, where you can actually overload unary operator &, it might be different, but it's still a very bad idea.

    If you turn on warnings, you'll get something like:

    warning: the address of ‘i’ will always evaluate as ‘true’

提交回复
热议问题