Monday, 12 November 2012

Week11_prnBitOneLn(unsigned int Val)

Writing print bit function in one line as follows:

void prnBitsOneLn(unsigned int Val){
  for(unsigned int bitNo = sizeof(Val)*8; bitNo > 0; printf("%d", !!(Val&(1<<(bitNo-1)))),bitNo --);
}

No comments:

Post a Comment