Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Short-circuiting in C
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Shao Miller, post: 4214642"] Though the strategy'd grow pretty quickly, maybe even: #include <stdio.h> const char * func(int a, int b, int c) { static const char * const ret[] = {"Boo.", "Yay."}; static const int table[2][2][2] = {{{0,0},{0,0}},{{0,0},{0,1}}}; return table[!!a][!!b][!!c][ret]; } int main(void) { puts(func(0, 0, 0)); puts(func(0, 0, 3)); puts(func(0, 5, 0)); puts(func(0, 7, 11)); puts(func(13, 0, 0)); puts(func(17, 0, 1)); puts(func(19, 23, 0)); puts(func(29, 31, 37)); return 0; } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Short-circuiting in C
Top