Why do '?' and '/?' give the same output in C?

  • A+

In C, why do these two pieces of code give the same output?

#include<stdio.h>  int main(void) {     const char c='/?';     printf("%c",c); } 


#include<stdio.h>  int main(void) {     const char c='?';     printf("%c",c); } 

I understand that a backslash is used to make quotes (" or ') and a backslash obvious to the compiler when we use printf(), but why does this work for the '?'?

/? is an escape sequence exactly equivalent to ?, and is used to escape trigraphs:

#include <stdio.h> int main(void) {     printf("%s %s", "??=", "?/?="); // output is # ??= } 


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: