Timeline for Find i^n, given n
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 25, 2014 at 6:39 | review | Low quality posts | |||
Nov 25, 2014 at 7:01 | |||||
Nov 25, 2014 at 6:34 | history | edited | bacchusbeale | CC BY-SA 3.0 |
improved answer
|
Nov 25, 2014 at 6:18 | comment | added | Ruslan |
Yeah, but what's the point of using 0==0 when it's identical to 1 ? Note that == has higher precedence than & , otherwise your (supposed) test of (i&0)==0 would always be true.
|
|
Nov 25, 2014 at 6:13 | comment | added | bacchusbeale | @Ruslan In CodeBlocks Mingw there is only 1 warning around i&0. i&0==0 is a test for even, if i is even the result is 0 else it is 1. | |
Nov 23, 2014 at 14:20 | comment | added | Ruslan |
It doesn't even compile because you must parenthesize the assignments after : in ?: statements in plain C. Also, what's the point of using 0==0 when you can use single char 1 ? And no need in parentheses before ? . Also, the last ?: statement could be shortened to c[j]=i&1?'i':'1'; .
|
|
Nov 22, 2014 at 20:06 | review | Low quality posts | |||
Nov 22, 2014 at 20:07 | |||||
Nov 22, 2014 at 19:48 | history | answered | bacchusbeale | CC BY-SA 3.0 |