New course! Every coder should learn Generative AI!
Try a free lesson0
How this program behaves at execution.....
#define TRUE #define FALSE main() { #ifdef TRUE && FALSE printf ("true") ; #else printf("false"); #endif }
2 Answers
+ 1
Here true and false Are predefined
And in 1st case true && false will result in 0 which means
Else will be executed, it will print false
0
It seems like this code prints true despite being syntactically incorrect. #ifdef just checks whether TRUE is somehow defined, which it is, and the rest with the && FALSE doesn't matter. Or in other words the compiler ignores the incorrect instructions "&&" and "FALSE" but it could throw an error as well. And you also need to write int main, not just main :)