Use of '??=', '??<' and '??>' in c

602 views Asked by At

I was going through few interview questions and I came across example as below. I tried the example for simple input/output and also for some logic and it works without any problems.

??=include <stdio.h>

int main(void) 
??<
    printf("Hello");
    // Other code lines here
    return 0;
??>

To my surprise, this worked without any compilation issue and output was as required.

What is the significance of '??=', '??<' and '??>' here ?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

What is the significance of '??=', '??<' and '??>' here ?

??= will be replaced with #,

??< will be replaced with {,

??> will be replaced with },

by the preprocessor. These are called trigraphs. There are 9 trigraphs in total; the others are:

??( will be replaced with [,

??) will be replaced with ],

??/ will be replaced with \,

??' will be replaced with ^,

??! will be replaced with |,

??- will be replaced with ~.

Trigraphs are processed very early in the translation process, before the source code is tokenized. They can affect comments and strings and character literals.