What does it mean"??!??!"in C language?

I once saw a code in C with the following line:

...
if (condicao1 ??!??! condicao2){
/* faca algo */
}
...

What does "mean??!??!"in C language?

 86
c
Author: vs06, 2014-02-04

3 answers

Means the same as ||.

In some places people do not have all the symbols needed to program in C on their keyboards, hence the trigraphs were created:

  • ??= = #
  • ??/ = \
  • ??' = ^
  • ??( = [
  • ??) = ]
  • ??! = |
  • ??< = {
  • ??> = }
  • ??- = ~

??!??! = (??!)(??!) = (|)(|) = ||.

As mentioned by @Laerte, this fell into disuse. Nowadays it only appears in demonstrations of obscure constructions that can be done in C and C++.

 96
Author: C. E. Gesser, 2014-02-04 11:40:27

The C compiler, seeing the characters ??! in sequence, turns them into |.

If I'm not mistaken this is due to the fact that in the old days were not very common computers with the key |.

That is, ??!??! is the same as ||, the binary operator "or".

 33
Author: André Leria, 2014-02-04 11:23:13

??! is a trigraph equivalent to the logical expression || (or)

This was invented because these 9 characters are not part of the ISO 646. Thus, in order for it to be possible to program on any keyboard that is compatible with this standard, the trygraphs were created.

These days this is so useless that some compilers (like GCC itself) have decided to leave them out by default. To enable trigraphs in GCC, one must pass-trigraphs per parameter in the build.

  1. http://renangreinert.blogspot.com.br/2011/08/nao-use-trigrafos.html
 33
Author: Laerte, 2014-02-04 11:32:24