 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can create macro using hess define 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 there. Now I am going to demonstrate you how you can create macros with the help of hess define pre-processor. So first of all, I am going to include a header file that is a stdio.h. Now I am going to create a macro with the help of hess define. So whenever you are going to create a macro, you have to write name of an identifier, which will work as a macro. So here name is size and its value will be five. So this five is the replacement value of macro. So name of macro is size and whenever you will be using in the program, the size identifier, it will be automatically replaced with the value five. And this will be done at the time of compilation that process is known as pre-processing. So this size will be replaced with five whenever you will be using size identifier in your program. And you can also say size as a macro. Now I am going to implement definition of main function. So here I am creating an array and here I am using the macro size. So here this size will be replaced with five. So size of array will be five. Now I am calling printf, which will display the masses and the percent d numbers. And this percent d will be replaced with size and size is a macro, which will be replaced with five. Now to read five numbers from user, I have to repeat a loop. So this loop will also repeat size times and with the help of scanf, it will read numbers from user. So this is the loop which will repeat five times because macro size is defining its value as five. And five numbers will be received through scanf with the help of this follow. Now I am going to display the entered numbers on output screen. So for that purpose, I am calling printf again. So it will display the masses you entered and with the help of follow, I am going to display these numbers on output screen. So this is the complete implementation of the program. So in this program, I have used macro four times. And whenever I will be compiling this code, all four macro that is size will be replaced with five automatically. So now I am going to execute this code so that you can understand how it will be working. So you can see the masses enter five numbers is displayed on output screen. So first macro is working properly. Now I have to enter five numbers. So I have entered five numbers 12345. So loop is repeating five times and five numbers are displayed on output screen. So it means all the macros are working properly. They are replaced with their value as five. Now what is the use of this macro? Whenever you are using macro, it works as a constant value and that constant value is defined at the beginning of the program with the help of hash defined. Now suppose if you want to replace this five with 10, so automatically all the size macros will be replaced with the value 10 automatically. So you don't have to replace values one by one. You just need to create a macro so that it will be replaced automatically at the time of compilation. Now again, I have to execute this code so that you can understand this time this macro will be replacing with the value 10 or not. So now you can see it is showing the message enter 10 numbers. So I have to enter 10 numbers because this time loop will work. Sorry, loop will repeat 10 times. So I have entered 10 numbers and the loop which is responsible for printing the numbers is also repeating 10 times. So this way you can understand this macro size is replacing its value with 10 now. So this way you can create constants with the help of hash defined. These constants are known as macro and they replace their values with a replacement value which is defined at the beginning of the code. So here hash defined is a pre-processor which is creating a macro whose name is size and its replacement value is 10. So I hope you have understood how you can create macros with the help of hash defined 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 watch various programming related videos there. Thank you for watching this video.