fork download
  1.  
  2. void printbits(unsigned int x){
  3. int i;
  4. int mask = 0x1;
  5.  
  6. for(i = 0; i < 16; i++){
  7. printf("%d", (x & (mask << i)));
  8. if(!i % 4) putchar(' ');
  9. }
  10. putchar('\n');
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void printbits(unsigned int)':
prog.cpp:7:33: error: 'printf' was not declared in this scope
   printf("%d", (x & (mask << i)));
                                 ^
prog.cpp:8:25: error: 'putchar' was not declared in this scope
   if(!i % 4) putchar(' ');
                         ^
prog.cpp:10:14: error: 'putchar' was not declared in this scope
  putchar('\n');
              ^
stdout
Standard output is empty