Code Snippets C

#include
#include
int main(void)
{
char ch;
int j;
ch = 'd';
/* display binary representation */
for( j = 128; j > 0; j = j / 2)
if(j & ch)
printf("1 ");
else
printf("0 ");
/* reverse bit pattern */
ch = ~ch;
printf("\n");
/* display binary representation */
for( j = 128; j > 0; j = j / 2 )
if(j & ch)
printf("1 ");
else
printf("0 ");
return 0;
}