devxlogo

The ## Concatenation Operator

The ## Concatenation Operator

The preprocessor ## operator concatenates macro arguments. For example:

 #define paste(x,y) x ## y


The paste() macro takes two arguments and concatenates them into one. The whitespaces surrounding the ## operator as well as the ## symbol are removed in the concatenation process. In the following example, the paste() function-like macro concatenates the literal 1000 and the affix L thereby creating the constant 1000L.
#define paste(x,y) x ## y#define LONG_MAX paste(1000,L) // LONG_MAX equals 1000L

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist