Displaying data as binary in C with bitmasks
You may use the shift operation;

char mask = 0x01; //define initial mask

if (mask&amp;mychar) printf("1"); // check that spesific bit

mask&lt;&lt;=1; //shift left


of course if you want to start checking from right hand then shift right you can do :

char mask = 0x80;

mask&gt;&gt;=1;