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
3 Antworten
+ 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..
0
thank you very much!
0
Edward Finkelstein your welcome...