Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is &&& operation in C

People also ask

What is Live Twice?

"Live Twice" is the title track and the second single from Scottish singer Darius's second album, Live Twice (2004). The song was released on 10 January 2005 as his sixth and final single. It peaked at number seven on the UK Singles Chart and number 24 in Ireland. "Live Twice"

What is love twice members?

Nayeon is Mia from The Princess Diaries, Jeongyeon and Sana are Molly and Sam from Ghost, Mina and Dahyun are Vic and Matthieu from La Boum, Sana and Tzuyu are Mia and Vincent from Pulp Fiction, Jeongyeon and Tzuyu are Romeo and Juliet from Romeo + Juliet, Jihyo and Jeongyeon are Itsuki/Hiroko and male Itsuki from Love ...

Who wrote love twice?

Twice members Jeongyeon, Chaeyoung, and Jihyo also took part in writing lyrics for two songs on the EP. What Is Love? What Is Love?


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’


There is no &&& operator or token in C. But the && (logical "and") and & (unary address-of or bitwise "and") operators do exist.

By the maximal munch rule, this:

c = i &&& i;

is equivalent to this:

c = i && & i;

It sets c to 1 if both i and &i are true, and to 0 if either of them is false.

For an int, any non-zero value is true. For a pointer, any non-null value is true (and the address of an object is always non-null). So:

It sets c to 1 if i is non-zero, or to 0 if i is equal to zero.

Which implies that the &&& is being used here just for deliberate obfuscation. The assignment might as well be any of the following:

c = i && 1;
c = !!i;
c = (bool)i;          // C++ or C with <stdbool.h>
c = i ? 1 : 0;        /* C */
c = i ? true : false; // C++