In the below code,since the bitwise complement of x is -1(using 2's Complement) and y is 2, I am expecting the value of z to be zero but I am getting the value of z as 2 when I run the program.Can anyone please explain me where I am going Wrong?
CODE
#include <stdio.h>
int main()
{
int x = 0, y = 2;
int z = ~x & y;
printf("%d\n", z);
}