Hex to bin after logical operations
Posted
by user355926
on Stack Overflow
See other posts from Stack Overflow
or by user355926
Published on 2010-06-01T22:46:23Z
Indexed on
2010/06/01
23:03 UTC
Read the original article
Hit count: 191
I want:
111 || 100 ---> 111, not 1
100 && 100 ---> 100, not 1
101 && 010 ---> 000, not 0
Broken code
#include <stdio.h>
main(void){
string hexa = 0xff;
strig hexa2 = 0xf1;
// CONVERT TO INT??? cast
int hexa3 = hexa || hexa2;
int hexa4 = hexa && hexa2;
puts(hexa3);
puts(hexa4);
}
© Stack Overflow or respective owner