fork download
  1. void printbits(unsigned int x){
  2. int i;
  3. int mask = 0x1;
  4.  
  5. for(i = 15; i >= 0; i--){
  6. printf("%d", (x >> i) & mask);
  7. if((i % 4) == 0) putchar(' ');
  8. }
  9. putchar('\n');
  10. }
  11.  
  12. unsigned rightrot(unsigned x, unsigned char n){
  13. __asm{
  14. mov ebx, x
  15. mov cl, n
  16. ror ebx, cl
  17. mov x, ebx
  18. };
  19. return x;
  20. }
  21.  
  22. int main(){
  23. unsigned x = 0x40;
  24.  
  25. printbits(x);
  26. x = rightrot(x, 4);
  27. printbits(x);
  28.  
  29. scanf("%d", &x);
  30. return 0;
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'printbits':
prog.c:6:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   printf("%d", (x >> i) & mask);
   ^
prog.c:6:3: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:6:3: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:7:20: warning: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
   if((i % 4) == 0) putchar(' ');
                    ^
prog.c: In function 'rightrot':
prog.c:13:7: error: expected '(' before '{' token
  __asm{
       ^
prog.c:14:3: error: unknown type name 'mov'
   mov ebx, x
   ^
prog.c:15:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mov'
   mov cl, n
   ^
prog.c:14:7: warning: unused variable 'ebx' [-Wunused-variable]
   mov ebx, x
       ^
prog.c:22:5: warning: 'main' is normally a non-static function [-Wmain]
 int main(){
     ^
prog.c: In function 'main':
prog.c:29:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  scanf("%d", &x);
  ^
prog.c:29:2: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c: In function 'rightrot':
prog.c:31:1: error: expected declaration or statement at end of input
 }
 ^
stdout
Standard output is empty