??? 08/28/06 19:49 Modified: 08/28/06 20:01 Read: times |
#123230 - The line is not inside an \\\'if\\\' statement Responding to: ???'s previous message |
tmp = x tmp = (val >> n) & 0x01; /* isolate the bit */ tmp STILL =x However, for let's say n = 2, after the first line : tmp = 0000 0110 & 0x01 ; -> 0000 0000 hence, the next line again check, if((0000 0110 && 0000 0001) != 0) Why tmp is still x? in both cases, the tmp is clearly overwritten after the instruction: tmp = (val >> n) & 0x01; However, i think i understand what are you trying to say. That is, if the expression is evaluated in a 'if' command, it wont be overwritten but in my case, the line you mentioned is not in a 'if' statement EDIT : Maybe i was confusing myself and i found that this instruction might just be much simpler and straight forward. if((tmp && 0x01) != 0) changed to if(tmp != 0) They carry the same meaning and it's straightforward. I'll give it a try tomorrow! |
Topic | Author | Date |
ADC0838 does not output correctly | 01/01/70 00:00 | |
here? | 01/01/70 00:00 | |
Hmm..i dont understand why | 01/01/70 00:00 | |
\'&\' in an if statement | 01/01/70 00:00 | |
The line is not inside an \\\'if\\\' statement | 01/01/70 00:00 | |
difference![]() | 01/01/70 00:00 |