Question

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 ?

Was it helpful?

Solution

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

gcc -trigraphs source.c

OTHER TIPS

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top