Q:

What Is Concatenation Operator in Embedded C?

0

What Is Concatenation Operator in Embedded C?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Token Pasting Operator (##) is sometimes called a merging or combining operator. It is used to merge two valid tokens, it is the reason we called it token concatenation. See the below example code,

#include <stdio.h>
#define MERGE(token1, token2) token1##token2
int main()
{
    int var1 = 10;
    int var2 = 20;
    int var3 = 30;
    printf("%d\n", MERGE(var, 1));
    printf("%d\n", MERGE(var, 2));
    printf("%d\n", MERGE(var, 3));
    return 0;
}

Output: 10 ,20,30

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
<< Significance of watchdog timer in Embedded Systems...