4
c99 standard  5.2.1.1 Trigraph sequences

2 EXAMPLE The following source line

printf("Eh???/n");

becomes (after replacement of the trigraph sequence ??/)

printf("Eh?\n");

It's saying that it will replace the trigraph sequence, but it's not .

It's printing "Eh???/n"

Am I missing something ?

Omkant
  • 9,018
  • 8
  • 39
  • 59
  • What compiler is this? Did you enable trigraphs? I believe they're disabled by default in a lot of compilers nowadays. – Mysticial Nov 28 '12 at 07:38

2 Answers2

5

Trigraphs are disabled by default in gcc. If you are using gcc then compile with -trigraphs to enable trigraphs:

gcc -trigraphs source.c
P.P
  • 117,907
  • 20
  • 175
  • 238
1

The ??/ in the printf is a trigraph character which is a part of C's preprocessor.

If you enable trigraph by using gcc -trigraphs source.c, it will convert ??/ into \. Your code will look like this:

printf("Eh???/n"); // Before enable trigraph

printf("Eh?\n"); // After enable trigraph

You can visit https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C for more information.

Possible duplicate of What does the C ??!??! operator do?

Huy
  • 191
  • 6
  • 18