fork(3) download
  1. #include <stdio.h>
  2.  
  3. template<class T>
  4. void print_bits(T in)
  5. {
  6. int i, len = sizeof(T) * 8;
  7. for (i = 0; i < len; ++i)
  8. printf("%d", (in >> i) & 0x1);
  9. printf("\n");
  10. }
  11.  
  12. int main(void)
  13. {
  14. char one = 1;
  15. char allOne = ~(char)0;
  16.  
  17. print_bits(one);
  18. print_bits(allOne);
  19. return 0;
  20. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
10000000
11111111