0
Help me with the output of c code and need explanation
int main() { #if !SOLO printf("Try Again"); #else printf("SoloLearn"); #endif return 0; }
2 Antworten
+ 3
If output is what you want, then you can simply run it.
Explanation:
#if !SOLO
Is a conditional evaluation. Which verifies whether something named SOLO was defined with a boolean-like value. When SOLO is defined using #define directive (for example),
#define SOLO 1
Then it is understood as being defined, and it has boolean-like value true (for having non-zero value). And code execution flows into `#else` block.
If SOLO was not defined, or was defined with boolean-like value false (zero), then code execution flows into `#if` block.
Reference:
http://www.cplusplus.com/doc/tutorial/preprocessor/
+ 1
Ipang thans a lot