Give the output on the screen of the following program
#include <stdio.h>
#define PRINT(i) printf("value = %d\n", i)
int main()
{
int x = 03, y = 02 , z = 01;
PRINT(x | y & z);
PRINT(x | y & - z);
PRINT(x ^ y & - z);
PRINT(x & y && z);
x = 1; y = -1;
PRINT(! x | x);
PRINT(- x | x);
PRINT(x ^ x);
x<<=3;PRINT(x);
y<<=3;PRINT(y);
y>>=3;PRINT(y);
return 0;
}
Difficulty level
This exercise is mostly suitable for students
value = 3
value = 3
value = 1
value = 1
value = 1
value = -1
value = 0
value = 8
value = -8
value = -1 (or random)
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Cuckoo hashing