I used a library to work with ST microcontroller. But I have not understood this define. Does anyone know anything about it.
#define CONCAT(x, y)            x ## y
I used a library to work with ST microcontroller. But I have not understood this define. Does anyone know anything about it.
#define CONCAT(x, y)            x ## y
As the name of the macro sounds it concatenates its arguments.
Here is a demonstration program.
#include <stdio.h>
#define CONCAT(x, y)            x ## y
int main( void ) 
{
    int CONCAT( my, Variable ) = 10;
    printf( "%d\n", myVariable );
}
In the program there is declared a variable with the name myVariable.
As the macro name suggests, the preprocessor operator ## concatenates two tokens together.
#include <stdio.h> 
#define CONCAT(x, y)            x ## y
int main()
{
    int ab = 4;
    printf("%d\n", CONCAT(a,b));
    return 0;
}