Advertisement
Shiny_

Untitled

Apr 5th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdarg.h>
  2. #include <stdio.h>
  3.  
  4. #define program(arguments) void main(void) {arguments;}
  5. #define calculate(...) (calculate__(sizeof((int[]){__VA_ARGS__})/sizeof(int), __VA_ARGS__))
  6.  
  7. int calculate__(int number, ...) {
  8.     int sum = 0;
  9.     va_list arguments;
  10.     va_start(arguments, number);
  11.    
  12.     for(int i = 0; i < number; i++) {
  13.         sum += va_arg(arguments, int);
  14.     }
  15.    
  16.     va_end(arguments);
  17.     return printf("%d", sum);
  18. }
  19.  
  20. #define __calculate calculate__
  21. #define _calculate calculate__
  22. typedef int * pointer_int;
  23. typedef void * pointer_void;
  24. typedef char * pointer_char;
  25.  
  26. program (
  27.     int i = 0;
  28.     printf("%d", i);
  29.     printf("%d", calculate(1 * 2 - 3 + 4 / 5))
  30. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement