Skip to content
Related Articles

Related Articles

Improve Article

C | Macro & Preprocessor | Question 14

  • Last Updated : 28 Jun, 2021

What is the output of following program?

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.

#include <stdio.h>
#define macro(n, a, i, m) m##a##i##n
#define MAIN macro(n, a, i, m)
int MAIN()
    return 0;

(A) Compiler Error
(B) GeeksQuiz
(D) main

Answer: (B)

Explanation: The program has a preprocessor that replaces “MAIN” with “macro(n, a, i, m)”. The line “macro(n, a, i, m)” is again replaced by main. The key thing to note is token pasting operator ## which concatenates parameters to macro.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :