Skip to content
Related Articles

Related Articles

Improve Article

C | Macro & Preprocessor | Question 8

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

#include <stdio.h>
#define a 10
int main()
  printf("%d ",a);
  #define a 50
  printf("%d ",a);
  return 0;

(A) Compiler Error
(B) 10 50
(C) 50 50
(D) 10 10

Answer: (B)

Explanation: Preprocessor doesn’t give any error if we redefine a preprocessor directive. It may give warning though. Preprocessor takes the most recent value before use of and put it in place of a.

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 :