What is the output of the below code?
#include<stdio.h> #define FALSE 0 #define OUTPUT printf("Talent");printf(" Eve"); int main() { int var_1=1; if(var_1--) OUTPUT else printf("embeddeddesignblog"); return FALSE; }
-----------------------------------------------------------------
The above code has a simple if-else conditional check statements. When if statement is executed, it checks for var_1 and the condition passes as var_1 is 1. Post decrement is performed once the condition is checked. So, the execution enters if statement, where OUTPUT macro is seen.
The macro has two printf statements, printf("Talent");printf(" Eve");
After considering the macro, the if-else looks as below:
if(var_1--)
printf(" Eve");
0 Comments