int main() {
unsigned int nr, mask;
printf("nr = "); //for eg. if i use number 11111111 or 00111111 it prints 0.
scanf("%hu", &nr);
if ((nr & 0b00001000) == 0)
printf("0\n\n");
else
printf("1\n\n");
mask = 0b00001000;
if (nr & mask)
printf("1\n");
else
printf("0\n");
printf("%x", nr);
return 0;
}
I can set a reset a bit using a mask like this 00001000 & nr(10101010)
with the "1" placed so the 4th bit will be rest, but again it doesn't work ( I don't know why). But I have no idea how to print the number after.