bitwise operations

Does anyone have any recommendations of a PDF or article for technical interview questions for c++ bitwise operations? I know its specific, but I am looking to study up on low level c++ programming.

Any help is appreciated.
The tutorial on this site briefly goes through them. It might be easier with just examples.

Quite neat things to work with, they also help you in electronics and Minecraft. ;)

1 == true
0 == false

| or - at least one or the other true
10010010
01010101
-------------
10010111

& and - both must be true
10010010
01010101
-------------
00010000

>> shift right - shunt all digits right
10000000
>> 3
-------------
00010000

<< shift left
00000100
<< 3
-------------
00100000

^ xor - one or the other, but not both
10010110
01010101
-------------
11000011

~ not - opposite truth values
11000011
-------------
00111100
Last edited on
Thanks for the help, but I was looking for things a little more complicated

EX:
#include<stdio.h>

1
2
3
4
5
6
7
8
9
10
11
12
13
#include<stdio.h>

int main()
{
    unsigned int num;
    int i;
    scanf("%u", &num);
    for(i=0; i&lt16; i++)
    {
        printf("%d", (num<<i & 1<<15)?1:0);
    }
    return 0;
}


What is the output of the code
Work it out yourself. ;) Same principles apply.
Last edited on
lol. I know the answer. I was looking for more examples similar to it.
Topic archived. No new replies allowed.