0

Output of C code

Can someone explain what this code does? #include <stdio.h> int main() { #if !SOLO { printf("Try Again"); } #else { printf("SoloLearn"); } #endif return 0; return 0; } https://code.sololearn.com/c2a0j6mMWt5f/#c

24th Jul 2020, 6:29 PM
Edward Finkelstein
Edward Finkelstein - avatar
3 Respostas
+ 1
#if !SOLO //it means if not SOLO defined, { printf("Try Again"); //execute this } #else. //else, SOLO defined then { printf("SoloLearn"); //execute this. } #endif This is same as if - else by macros. Then code not defined SOLO macro constant anywhere, so if part is not(SOLO) is true. (SOLO not defined) then it prints Try again. Check by adding #define SOLO 1 It prints else part. Hope this helps..
24th Jul 2020, 7:05 PM
Jayakrishna 🇮🇳
0
thank you very much!
24th Jul 2020, 7:16 PM
Edward Finkelstein
Edward Finkelstein - avatar
0
Edward Finkelstein your welcome...
24th Jul 2020, 7:21 PM
Jayakrishna 🇮🇳