Skip to content
Related Articles

Related Articles

Improve Article

C | Macro & Preprocessor | Question 9

  • Difficulty Level : Easy
  • Last Updated : 09 Feb, 2013
Geek Week

Output?




#include<stdio.h> 
#define f(g,g2) g##g2 
int main() 
   int var12 = 100; 
   printf("%d", f(var,12)); 
   return 0; 
}

(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; 
}
Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
My Personal Notes arrow_drop_up
Recommended Articles
Page :