I have the following snippet of C:
return 5 ? printf("Evaluated true") : printf("Evaluated false");
So I'm puzzled how this works - the return obviously must be done to be evaluated - but then this code actually does print either "Evaluated true" or "Evaluated false". So how does further code get run from this after the return statement? Is it because this one conditional line of code is kind of 'atomic'? And that's why we don't just blow off printing the result straight after the return statement?
Also, 'return 5' evaluates to true, 'return 0' evaluates to false. In fact, I think anything but 0 evaluates to true.
So can someone tell me what goes on with this line of code, and how it is processed and run through in an application? (Been looking through my ansi_c.pdf but can't find any info on this).
Thanks a lot!