#include <stdio.h>
//Macro to Get bit from the given position
#define GET_BITS(data, pos) ((data & ( 1 << pos)) >> pos)

int main()
{
    unsigned char value = 16; //value in hex 00010000
    unsigned char position = 0;
    printf("%d\n", GET_BITS(value,position)); //print gets value from the 0th position
    position = 1;
    printf("%d\n", GET_BITS(value,position)); //print gets value from 1rd position
    position = 2;
    printf("%d\n", GET_BITS(value,position)); //print gets value from 2rd position
    position = 3;
    printf("%d\n", GET_BITS(value,position)); //print gets value from 3rd position
    position = 4;
    printf("%d\n", GET_BITS(value,position)); //print gets value from 4rd position
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: