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; }

15th Jul 2021, 3:47 AM
DEBANJAN GHOSH
DEBANJAN GHOSH - avatar
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/
15th Jul 2021, 4:10 AM
Ipang
+ 1
Ipang thans a lot
15th Jul 2021, 5:44 AM
DEBANJAN GHOSH
DEBANJAN GHOSH - avatar