fork download
  1. #include <stdio.h>
  2.  
  3. printf_(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9)
  4. char fmt[];
  5. {
  6. char s[];
  7. auto adx[], x, c;
  8.  
  9. adx = &x1; /* argument pointer */
  10. loop:
  11. while((c = *fmt++) != '%') {
  12. if(c == '\0')
  13. return;
  14. putchar(c);
  15. }
  16. x = *adx++;
  17. switch (c = *fmt++) {
  18.  
  19. case 'd': /* decimal */
  20. case 'o': /* octal */
  21. if(x < 0) {
  22. x = -x;
  23. if(x<0) { /* is - infinity */
  24. if(c=='o')
  25. printf("100000");
  26. else
  27. printf("-32768");
  28. goto loop;
  29. }
  30. putchar('-');
  31. }
  32. printn(x, c=='o'?8:10);
  33. goto loop;
  34.  
  35. case 'c': /* char */
  36. putchar(x);
  37. goto loop;
  38.  
  39. case 's': /* string */
  40. s = x;
  41. while(c = *s++)
  42. putchar(c);
  43. goto loop;
  44. }
  45. putchar('%');
  46. fmt--;
  47. adx--;
  48. goto loop;
  49. }
  50.  
  51. int main(void)
  52. {
  53. printf_("abc %d\n", 11);
  54. return 0;
  55. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 printf_(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9)
 ^
prog.c: In function 'printf_':
prog.c:3:1: warning: type of 'x1' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x2' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x3' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x4' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x5' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x6' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x7' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x8' defaults to 'int' [-Wimplicit-int]
prog.c:3:1: warning: type of 'x9' defaults to 'int' [-Wimplicit-int]
prog.c:6:7: error: array size missing in 's'
  char s[];
       ^
prog.c:7:7: warning: type defaults to 'int' in declaration of 'adx' [-Wimplicit-int]
  auto adx[], x, c;
       ^
prog.c:7:7: error: array size missing in 'adx'
prog.c:7:14: warning: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
  auto adx[], x, c;
              ^
prog.c:7:17: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
  auto adx[], x, c;
                 ^
prog.c:9:6: error: assignment to expression with array type
  adx = &x1; /* argument pointer */
      ^
prog.c:13:4: warning: 'return' with no value, in function returning non-void
    return;
    ^
prog.c:16:10: error: lvalue required as increment operand
  x = *adx++;
          ^
prog.c:32:3: warning: implicit declaration of function 'printn' [-Wimplicit-function-declaration]
   printn(x, c=='o'?8:10);
   ^
prog.c:40:5: error: assignment to expression with array type
   s = x;
     ^
prog.c:41:15: error: lvalue required as increment operand
   while(c = *s++)
               ^
prog.c:47:5: error: lvalue required as decrement operand
  adx--;
     ^
stdout
Standard output is empty