Preprocessor token math

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include "dio.h" void foo3() { printf("foo 3\n"); } void foo4() { printf("foo 4\n"); } void foo6() { printf("foo 6\n"); } void foo7() { printf("foo 7\n"); } void foo15() { printf("foo 15\n"); } #define concat_(a, b) a##b #define concat(a, b) concat_(a, b) #define foo(f, a, b) concat(foo, f##a##_##b)() int main(void) { foo(add, 5, 2); foo(sub, 9, 3); foo(rem, 3, 5); foo(mul, 3, 5); foo(div, 9, 2); printf("\n"); for(int i = 0; i < 10; ++i) { for(int j = 0; j < 10; ++j) { printf("#define add%i_%i %i\n", i, j, i + j); printf("#define sub%i_%i %i\n", i, j, i - j); printf("#define mul%i_%i %i\n", i, j, i * j); if(j != 0) { printf("#define div%i_%i %i\n", i, j, i / j); printf("#define rem%i_%i %i\n", i, j, i % j); } else { printf("#define div%i_%i %i\n", i, j, 0); printf("#define rem%i_%i %i\n", i, j, 0); } } } return 0; }
#define add0_0 0 #define sub0_0 0 #define mul0_0 0 #define div0_0 0 #define rem0_0 0 #define add0_1 1 #define sub0_1 -1 #define mul0_1 0 #define div0_1 0 #define rem0_1 0 #define add0_2 2 #define sub0_2 -2 #define mul0_2 0 #define div0_2 0 #define rem0_2 0 #define add0_3 3 #define sub0_3 -3 #define mul0_3 0 #define div0_3 0 #define rem0_3 0 #define add0_4 4 #define sub0_4 -4 #define mul0_4 0 #define div0_4 0 #define rem0_4 0 #define add0_5 5 #define sub0_5 -5 #define mul0_5 0 #define div0_5 0 #define rem0_5 0 #define add0_6 6 #define sub0_6 -6 #define mul0_6 0 #define div0_6 0 #define rem0_6 0 #define add0_7 7 #define sub0_7 -7 #define mul0_7 0 #define div0_7 0 #define rem0_7 0 #define add0_8 8 #define sub0_8 -8 #define mul0_8 0 #define div0_8 0 #define rem0_8 0 #define add0_9 9 #define sub0_9 -9 #define mul0_9 0 #define div0_9 0 #define rem0_9 0 #define add1_0 1 #define sub1_0 1 #define mul1_0 0 #define div1_0 0 #define rem1_0 0 #define add1_1 2 #define sub1_1 0 #define mul1_1 1 #define div1_1 1 #define rem1_1 0 #define add1_2 3 #define sub1_2 -1 #define mul1_2 2 #define div1_2 0 #define rem1_2 1 #define add1_3 4 #define sub1_3 -2 #define mul1_3 3 #define div1_3 0 #define rem1_3 1 #define add1_4 5 #define sub1_4 -3 #define mul1_4 4 #define div1_4 0 #define rem1_4 1 #define add1_5 6 #define sub1_5 -4 #define mul1_5 5 #define div1_5 0 #define rem1_5 1 #define add1_6 7 #define sub1_6 -5 #define mul1_6 6 #define div1_6 0 #define rem1_6 1 #define add1_7 8 #define sub1_7 -6 #define mul1_7 7 #define div1_7 0 #define rem1_7 1 #define add1_8 9 #define sub1_8 -7 #define mul1_8 8 #define div1_8 0 #define rem1_8 1 #define add1_9 10 #define sub1_9 -8 #define mul1_9 9 #define div1_9 0 #define rem1_9 1 #define add2_0 2 #define sub2_0 2 #define mul2_0 0 #define div2_0 0 #define rem2_0 0 #define add2_1 3 #define sub2_1 1 #define mul2_1 2 #define div2_1 2 #define rem2_1 0 #define add2_2 4 #define sub2_2 0 #define mul2_2 4 #define div2_2 1 #define rem2_2 0 #define add2_3 5 #define sub2_3 -1 #define mul2_3 6 #define div2_3 0 #define rem2_3 2 #define add2_4 6 #define sub2_4 -2 #define mul2_4 8 #define div2_4 0 #define rem2_4 2 #define add2_5 7 #define sub2_5 -3 #define mul2_5 10 #define div2_5 0 #define rem2_5 2 #define add2_6 8 #define sub2_6 -4 #define mul2_6 12 #define div2_6 0 #define rem2_6 2 #define add2_7 9 #define sub2_7 -5 #define mul2_7 14 #define div2_7 0 #define rem2_7 2 #define add2_8 10 #define sub2_8 -6 #define mul2_8 16 #define div2_8 0 #define rem2_8 2 #define add2_9 11 #define sub2_9 -7 #define mul2_9 18 #define div2_9 0 #define rem2_9 2 #define add3_0 3 #define sub3_0 3 #define mul3_0 0 #define div3_0 0 #define rem3_0 0 #define add3_1 4 #define sub3_1 2 #define mul3_1 3 #define div3_1 3 #define rem3_1 0 #define add3_2 5 #define sub3_2 1 #define mul3_2 6 #define div3_2 1 #define rem3_2 1 #define add3_3 6 #define sub3_3 0 #define mul3_3 9 #define div3_3 1 #define rem3_3 0 #define add3_4 7 #define sub3_4 -1 #define mul3_4 12 #define div3_4 0 #define rem3_4 3 #define add3_5 8 #define sub3_5 -2 #define mul3_5 15 #define div3_5 0 #define rem3_5 3 #define add3_6 9 #define sub3_6 -3 #define mul3_6 18 #define div3_6 0 #define rem3_6 3 #define add3_7 10 #define sub3_7 -4 #define mul3_7 21 #define div3_7 0 #define rem3_7 3 #define add3_8 11 #define sub3_8 -5 #define mul3_8 24 #define div3_8 0 #define rem3_8 3 #define add3_9 12 #define sub3_9 -6 #define mul3_9 27 #define div3_9 0 #define rem3_9 3 #define add4_0 4 #define sub4_0 4 #define mul4_0 0 #define div4_0 0 #define rem4_0 0 #define add4_1 5 #define sub4_1 3 #define mul4_1 4 #define div4_1 4 #define rem4_1 0 #define add4_2 6 #define sub4_2 2 #define mul4_2 8 #define div4_2 2 #define rem4_2 0 #define add4_3 7 #define sub4_3 1 #define mul4_3 12 #define div4_3 1 #define rem4_3 1 #define add4_4 8 #define sub4_4 0 #define mul4_4 16 #define div4_4 1 #define rem4_4 0 #define add4_5 9 #define sub4_5 -1 #define mul4_5 20 #define div4_5 0 #define rem4_5 4 #define add4_6 10 #define sub4_6 -2 #define mul4_6 24 #define div4_6 0 #define rem4_6 4 #define add4_7 11 #define sub4_7 -3 #define mul4_7 28 #define div4_7 0 #define rem4_7 4 #define add4_8 12 #define sub4_8 -4 #define mul4_8 32 #define div4_8 0 #define rem4_8 4 #define add4_9 13 #define sub4_9 -5 #define mul4_9 36 #define div4_9 0 #define rem4_9 4 #define add5_0 5 #define sub5_0 5 #define mul5_0 0 #define div5_0 0 #define rem5_0 0 #define add5_1 6 #define sub5_1 4 #define mul5_1 5 #define div5_1 5 #define rem5_1 0 #define add5_2 7 #define sub5_2 3 #define mul5_2 10 #define div5_2 2 #define rem5_2 1 #define add5_3 8 #define sub5_3 2 #define mul5_3 15 #define div5_3 1 #define rem5_3 2 #define add5_4 9 #define sub5_4 1 #define mul5_4 20 #define div5_4 1 #define rem5_4 1 #define add5_5 10 #define sub5_5 0 #define mul5_5 25 #define div5_5 1 #define rem5_5 0 #define add5_6 11 #define sub5_6 -1 #define mul5_6 30 #define div5_6 0 #define rem5_6 5 #define add5_7 12 #define sub5_7 -2 #define mul5_7 35 #define div5_7 0 #define rem5_7 5 #define add5_8 13 #define sub5_8 -3 #define mul5_8 40 #define div5_8 0 #define rem5_8 5 #define add5_9 14 #define sub5_9 -4 #define mul5_9 45 #define div5_9 0 #define rem5_9 5 #define add6_0 6 #define sub6_0 6 #define mul6_0 0 #define div6_0 0 #define rem6_0 0 #define add6_1 7 #define sub6_1 5 #define mul6_1 6 #define div6_1 6 #define rem6_1 0 #define add6_2 8 #define sub6_2 4 #define mul6_2 12 #define div6_2 3 #define rem6_2 0 #define add6_3 9 #define sub6_3 3 #define mul6_3 18 #define div6_3 2 #define rem6_3 0 #define add6_4 10 #define sub6_4 2 #define mul6_4 24 #define div6_4 1 #define rem6_4 2 #define add6_5 11 #define sub6_5 1 #define mul6_5 30 #define div6_5 1 #define rem6_5 1 #define add6_6 12 #define sub6_6 0 #define mul6_6 36 #define div6_6 1 #define rem6_6 0 #define add6_7 13 #define sub6_7 -1 #define mul6_7 42 #define div6_7 0 #define rem6_7 6 #define add6_8 14 #define sub6_8 -2 #define mul6_8 48 #define div6_8 0 #define rem6_8 6 #define add6_9 15 #define sub6_9 -3 #define mul6_9 54 #define div6_9 0 #define rem6_9 6 #define add7_0 7 #define sub7_0 7 #define mul7_0 0 #define div7_0 0 #define rem7_0 0 #define add7_1 8 #define sub7_1 6 #define mul7_1 7 #define div7_1 7 #define rem7_1 0 #define add7_2 9 #define sub7_2 5 #define mul7_2 14 #define div7_2 3 #define rem7_2 1 #define add7_3 10 #define sub7_3 4 #define mul7_3 21 #define div7_3 2 #define rem7_3 1 #define add7_4 11 #define sub7_4 3 #define mul7_4 28 #define div7_4 1 #define rem7_4 3 #define add7_5 12 #define sub7_5 2 #define mul7_5 35 #define div7_5 1 #define rem7_5 2 #define add7_6 13 #define sub7_6 1 #define mul7_6 42 #define div7_6 1 #define rem7_6 1 #define add7_7 14 #define sub7_7 0 #define mul7_7 49 #define div7_7 1 #define rem7_7 0 #define add7_8 15 #define sub7_8 -1 #define mul7_8 56 #define div7_8 0 #define rem7_8 7 #define add7_9 16 #define sub7_9 -2 #define mul7_9 63 #define div7_9 0 #define rem7_9 7 #define add8_0 8 #define sub8_0 8 #define mul8_0 0 #define div8_0 0 #define rem8_0 0 #define add8_1 9 #define sub8_1 7 #define mul8_1 8 #define div8_1 8 #define rem8_1 0 #define add8_2 10 #define sub8_2 6 #define mul8_2 16 #define div8_2 4 #define rem8_2 0 #define add8_3 11 #define sub8_3 5 #define mul8_3 24 #define div8_3 2 #define rem8_3 2 #define add8_4 12 #define sub8_4 4 #define mul8_4 32 #define div8_4 2 #define rem8_4 0 #define add8_5 13 #define sub8_5 3 #define mul8_5 40 #define div8_5 1 #define rem8_5 3 #define add8_6 14 #define sub8_6 2 #define mul8_6 48 #define div8_6 1 #define rem8_6 2 #define add8_7 15 #define sub8_7 1 #define mul8_7 56 #define div8_7 1 #define rem8_7 1 #define add8_8 16 #define sub8_8 0 #define mul8_8 64 #define div8_8 1 #define rem8_8 0 #define add8_9 17 #define sub8_9 -1 #define mul8_9 72 #define div8_9 0 #define rem8_9 8 #define add9_0 9 #define sub9_0 9 #define mul9_0 0 #define div9_0 0 #define rem9_0 0 #define add9_1 10 #define sub9_1 8 #define mul9_1 9 #define div9_1 9 #define rem9_1 0 #define add9_2 11 #define sub9_2 7 #define mul9_2 18 #define div9_2 4 #define rem9_2 1 #define add9_3 12 #define sub9_3 6 #define mul9_3 27 #define div9_3 3 #define rem9_3 0 #define add9_4 13 #define sub9_4 5 #define mul9_4 36 #define div9_4 2 #define rem9_4 1 #define add9_5 14 #define sub9_5 4 #define mul9_5 45 #define div9_5 1 #define rem9_5 4 #define add9_6 15 #define sub9_6 3 #define mul9_6 54 #define div9_6 1 #define rem9_6 3 #define add9_7 16 #define sub9_7 2 #define mul9_7 63 #define div9_7 1 #define rem9_7 2 #define add9_8 17 #define sub9_8 1 #define mul9_8 72 #define div9_8 1 #define rem9_8 1 #define add9_9 18 #define sub9_9 0 #define mul9_9 81 #define div9_9 1 #define rem9_9 0
Editor Settings
Theme
Key bindings
Full width
Lines