Examveda
Examveda

What will be the output of the program code?
#include<stdio.h>
#define a 10
void main()
{
      #define a 50
      printf("%d", a);
}

A. 50

B. 10

C. Compiler Error

D. None of These

Answer: Option A

Solution(By Examveda Team)

The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.

Join The Discussion

Related Questions on C Preprocessor

C preprocessor

A. Takes care of conditional compilation

B. Takes care of macros

C. Takes care of include files

D. Acts before compilation

E. All of the above

A preprocessor command

A. need not start on a new line

B. need not start on the first column

C. has # as the first character

D. comes before the first executable statement