Google News
logo
Embedded C - Interview Questions
What Is Concatenation Operator in Embedded C?
The Concatenation operator is indicated by the usage of ##. It is used in macros to perform concatenation of the arguments in the macro. We need to keep note that only the arguments are concatenated, not the values of those arguments.
 
For example, if we have the following piece of code :
#define CUSTOM_MACRO(x, y) x##y

main(){

  int xValue = 20;
  printf(“%d”, CUSTOM_MACRO(x, Value));    //Prints 20

}
We can think of it like this if arguments x and y are passed, then the macro just returns xy -> The concatenation of x and y.
Advertisement