int a = 4==4?:7;
cout<<a<<endl;
Shouldn’t the above code produce a compilation error? Also, the value I get is 1
. Is there any explanation for that?
I tried with,
int a = 4==4?7:;
This does give a compilation error.
My best guess is that it interprets the first expression in a different way that might be syntactically correct.