#include <stdio.h>
int main() {
int bin = 0b0101; //4321
int hex = 0x5A04; //12 8 4 null -> since each element like 5 = 0101, A = 1010 so it take 4 values each
// Extracting the third bit (index 2)
int thirdBit = (bin >> 2) & 1;
int trdb = (hex >> 8) & 0xF;
printf("bin value: %d\n", bin);
printf("The third bit is: %d\n", thirdBit);
printf("The third hex bit is: %x\n", trdb);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: