#include <stdio.h> #include <stdint.h> int isBitSet(unsigned char reg, int pos){ return (reg &(1 << pos))? 1:0; } int main(){ unsigned char reg; int pos; scanf("%hhu %d", ®, &pos); printf("%d\n", isBitSet(reg, pos)); return 0; }
Test Cases
Test Results
Input
4 2
Expected Output
1