// filename:c2011-6-10-3-3-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 6.10.3.3 The ## operator // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. #include // Example #define hash_hash # ## # #define mkstr(a) # a #define in_between(a) mkstr(a) #define join(c, d) in_between(c hash_hash d) char p[] = join(x, y); // equivalent to // char p[] = "x ## y"; int main(void) { return printf("6.10.3.3 The ## operator, %s, %s, %s, %s, %s\n",join(x, y),in_between(x hash_hash y),in_between(x ## y),mkstr(x ## y),"x ## y"); } // output may be // 6.10.3.3 The ## operator, x ## y, x ## y, x ## y, x ## y, x ## y