(n > 0) && printf("0 ", 0);
Never saw something like this. A conditional execution without an if? (n > 0) && printf("0 ", 0);
Never saw something like this. A conditional execution without an if?I remember following a really old Python tutorial that suggested the way to write inline if/else statements was
C and A or B
which makes use of similar short-circuiting behavior. Nowadays this is written as A if C else B
The and/or version depends on A being truthy, otherwise it evaluates both A and B, giving the value of B.