Code:
#include<stdio.h>
#include<conio.h>
Void fun();
Main()
{
[B]Int a=20;
#define a 10[/B]
Clrscr();
Printf(“%d”,a);
Fun();
[B]Printf(“\n%d”,a);[/B]
Getch();
}
Void fun()
{
Printf(“\n%d”,a);
#undef a
}
10
10
10
Doubt:
a)my first doubt iws whenever we print the value of a in the main function it prints 10(it does not print the value of the variable a=20).how to use the value of the variable a in the main function?
b)my second doubt is that as the a is un defined in the function fun(),the printf statement executed after the fun(bolded in the above program) should have printed 20 or it should have shown an error.instead it prints 10.then what is the use of undef statement?
Comment