+ 1
Why output is 'Try Again' ?
int main() { #if !SOLO printf("Try Again"); #else printf("Sololearn"); #endif return 0; return 0; } Somehow string '!SOLO' is getting converted to a non-zero value. Can someone explain how ?
3 odpowiedzi
+ 3
Is this all the code? Is SOLO defined? If not then SOLO is 0 and it is saying !0 which is 1.
#define SOLO 1
+ 2
Ya, that's pretty much what I said. Lol
Add the #define line from my previous post before main (or at least before the #if) and it will work as expected.
+ 1
ChaoticDawg This is the whole code and it runs without any error. My guess is if SOLO is not defined (as in this case) it will be treated as 0.