Output?
#include<stdio.h> #define f(g,g2) g##g2 int main() { int var12 = 100; printf("%d", f(var,12)); return 0; } |
chevron_right
filter_none
(A) 100
(B) Compiler Error
(C) 0
(D) 1
Answer: (A)
Explanation: The operator ## is called “Token-Pasting” or “Merge” Operator. It merges two tokens into one token. So, after preprocessing, the main function becomes as follows, and prints 100.
int main()
{
int var12 = 100;
printf("%d", var12);
return 0;
}
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C | Macro & Preprocessor | Question 1
- C | Macro & Preprocessor | Question 2
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 4
- C | Macro & Preprocessor | Question 5
- C | Macro & Preprocessor | Question 6
- C | Macro & Preprocessor | Question 7
- C | Macro & Preprocessor | Question 8
- C | Macro & Preprocessor | Question 10
- C | Macro & Preprocessor | Question 11
- C | Macro & Preprocessor | Question 12
- C | Macro & Preprocessor | Question 13
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 15
- Write a C macro PRINT(x) which prints x
- The OFFSETOF() macro
- CRASH() macro - interpretation
- How a Preprocessor works in C?
- C/C++ Preprocessor directives | Set 2
- C | Loops & Control Structure | Question 1

