C Programming - C Preprocessor - Discussion

Discussion Forum : C Preprocessor - True / False Questions (Q.No. 7)
Macros have a local scope.
Answer: Option

False, The scope of macros is globals and functions. Also the scope of macros is only from the point of definition to the end of the file.

2 comments Page 1 of 1.

Nitesh said:   4 years ago

As we know when we use a global variable then it works throughOut the Programme So here is also the same Concept Applies When we use Macro it Works throughout the programme.

I leave one example as below:
# define i 20
void fun(){
#undef i
#define i 30

int main(){
printf(" %d",i);
return 0;

Output:30 30.

Elder John said:   7 years ago
Why shouldn't it be Ture?

Post your comments here:

Your comments will be displayed after verification.