 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how to use hash-undef directive in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube. My channel will be available there. You can watch various programming related videos here. Now I am going to demonstrate you the use of hash-undef directive. First of all, I have included a header file that is STDI.H. Now I am going to define a macro whose name is PI and its replacement token value is 3.141. So I have implemented this PI macro with the help of hash-defined preprocessor. Now I am going to define main function. Inside main function, I am going to display value of PI on output screen. So right now I am not using hash-undef. So first I am going to demonstrate you the use of macro. Then I will be demonstrating the use of hash-undef directive. So now I am going to execute this code. It will show value of PI on output screen with the help of this PI macro. So now I am going to execute this code. You can see the output value of PI is 3.14. So the output is printed correctly. Now what is the use of hash-undef? So till line number 6, I have used the macro PI. Now after line number 6, I don't want to allow user to use PI macro. So I can use hash-undef directive and name of macro that is PI. So this hash-undef will undefine this macro. So after line number 7, this PI macro will not be available. So if I write this statement again, that is value of PI equals to percent point 2f. So if I write this statement at line number 8 after line number 7, that is defining hash-undef PI. So line number 8 will be producing a compilation error. So now I am going to compile this code. You can see line number 8 is showing an error. That error is PI was not declared in this scope. So if I am using hash-undef, it means PI macro is undefined at line number 7. So after line number 7, I can't use this macro PI which is defined at line number 3. So this is the use of undef directive. So if you want to undefine a particular macro which is defined using hash-defined, then you can use hash-undef directive. Now if I remove this statement and if I compile the code, you can see now it is not showing any particular error because I have removed that hash-undef directive. So friends, I hope you have understood if at any particular point of time or at any particular line number or after that line number, you don't want to use or you don't want to allow programmer to use a particular macro that you can undefine a particular macro with the help of hash-undef directive. So this is all about hash-undef directive in C programming. If you want to watch more programming related videos, you can search my name Sanjay Gupta in YouTube. My channel will be available there. You can also download my programming app Atlas which is available on Google Play. Thank you for watching this video.