X-Git-Url: http://pileus.org/git/?p=~andy%2Fsfvlug;a=blobdiff_plain;f=c%2Fsrc%2Fcpp.c;fp=c%2Fsrc%2Fcpp.c;h=351837179c94888cfba997b6d0b584c9a2333825;hp=0000000000000000000000000000000000000000;hb=bc60878f14313f857dedc9954f189f37528386b7;hpb=4d380e0b82a77240bc5859c13161e90128d15f0d diff --git a/c/src/cpp.c b/c/src/cpp.c new file mode 100644 index 0000000..3518371 --- /dev/null +++ b/c/src/cpp.c @@ -0,0 +1,35 @@ +#include + +#define ANSWER 42 + +#define COUNTER counter++ + +#define DONT printf("Don't" +#define DO " do " +#define THIS "this!\n"); + +#define HELLO1(name) printf("Hello, %s\n", name) + +#define HELLO2(name) printf("Hello, " #name "\n") + +int main() +{ + int counter = 0; + + printf("The answer is %d.\n", ANSWER); + printf("\n"); + + printf("The counter is %d.\n", COUNTER); + printf("The counter is %d.\n", COUNTER); + printf("The counter is %d.\n", COUNTER); + printf("\n"); + + DONT DO THIS + printf("\n"); + + HELLO1("Andy"); + HELLO2(Andy); + HELLO2("Andy"); + + return 0; +}