bitwise operations in c++, how to actually use it? -
i understand
11001110 & 10011000 = 10001000
but want test myself
so declare unsigned char , print out, gives me blank.
unsigned char result; result= 11001110 & 10011000; cout<<result;
also tested unsigned int, gives me 0, not expected
11001110
, 10011000
aren't binary numbers (at least in compiler's mind).
binary 11001110
206
, , 10011000
152
, want (i think):
result = 206 & 152;
or use std::bitset
, print result binary.
Comments
Post a Comment