Hello everyone, my name is Atharva and we are continuing with this C programming course.
We will move on to this video and see about preprocessor and header files, as it is we have already learned about them in the basics.
Still, we will recap it once and we will see what is this preprocessor, what is the header file and how does it work? So, we will start with the very first thing, what is a preprocessor? We have seen that whichever are our programs, we write preprocessor commands in them.
So, what are these preprocessor commands or why do we write the preprocessor commands? First of all, we will understand what preprocessor is exactly? So, “C preprocessor is just a tool and it instructs the compiler to do required preprocessing before the actual compilation.” So, the compiler who reads our program and understands it and according to it tells the computer to perform the actions.
So, what does that compiler understand with the preprocessor commands? He understands that the compiler has to do some preprocessing, which means whichever files are written in preprocessor command, our compiler needs to import those.
So, who is telling our compiler that you have to import all these things before the start of your program? Our preprocessor tells the compiler that you have to follow these preprocessor commands and after that whatever is returned written in the command, you have to follow that and then take the action, before you start your program.
So, if you see here there are two parts to the compilation process.
The first part is of preprocessing, so here our preprocessor is not connected to the compiler, it is slightly different, which means it is a separate entity.
But what is its work? Its work is to tell our compiler that the preprocessor command that we have written, what does it mean.
When the preprocessor explains the compiler then the compiler easily understands it and it performs action on it.
So, this is a story about preprocessing and preprocessor.
And of the hash include and hash define commands that we write.
Now we can move ahead and see a few preprocessor directives which we use in our C program.
As it is, there are many such preprocessor directives which we can use.
But here we will be discussing basic three, in which the first is our hash define preprocessor directive.
So, we all know what is this preprocessing directive, preprocessing command or preprocessor command, where it starts from that is one hash sign.
Along with the hash sign , there is one keyword written and we call it as preprocessor directive.
Which means the command which is written as a preprocessor command.
What exactly should be in that command? This is told by the preprocessor directive.
If we have to import a certain file we will be using a hash include preprocessor directive.
If we want to define such a thing, suppose I want to replace the numeric one with a normal English one.
Then I will use hash define preprocessor directive.
In the same way, there are a lot of preprocessor directives and they have different meanings and different functionalities.
But we have considered only three over here.
First is hash define, we all know that it helps us to give alias name to anything.
Second, if we talk about hash un def preprocessor directive, what does this basically do? With hash define, whichever things we had defined.
Because of undef that thing gets away after being defined, which means it doesn't exist in future.
And then the third preprocessor directive which we use mostly.
That is our hash include preprocessor directive and what does this do? It helps us to import or insert any particular header file in our program.
So, this was about our preprocessors and preprocessor directives.
Now we will move ahead and discuss what these header files are and they can be of all types.
If we talk about one header file, a header file is a file with extension dot h.
We all know that whichever header files we use like stdio dot h, stdlib dot h, like these there are many, like math dot h, etc. etc etc..
Whichever header files are there.
There extension after dot, we put is every time.
So, this is its speciality and this is its identity.
After this we will see that these header files contains C function declaration and macro definitions.
These header files basically, these keep some C functions, in itself so that we can directly call them.
And we don't have to write its definition and declaration.
This is what the first sentence tries to explain to us.
If we talk ahead of this, it is imported by using the hash include command. We all know that with hash include many times in the form of preprocessor command, we have imported many header files.
Header files are basically used from hash include preprocessor directive.
Apart from this, if we talk about the third thing, we are considering in our header files, that is header files are already defined in C programming or we can make our own header file.
So, what are the header files basically? It is any function’s declaration which is written in a different file.
And with the help of a processor directive, we are importing it there so that we can use it in our program.
And we don't have to write the definition of that function frequently.
Like this we can also make our own header files.
Going ahead you can explore more about this than how to make your own header files and how you can use it.
So, this was a story about our preprocessor, preprocessor directives and header files.
If you have any queries or comments, click the discussion button below the video and post there. This way, you will be able to connect to fellow learners and discuss the course. Also, Our Team will try to solve your query.
In the next video, we will be seeing about type casting.
So, the next type casting module which would be there, what would be
doing in it, if you change the data type’s type or the variable’s type to be
more precise, what will happen here, we have made integer type variable.
And going ahead, I can declare it a float type so that the value stored
in it, should be stored in the float type going ahead.
So, in this way we can cost the type. So, we'll see how we can do it in our next video.
Till that time you discuss and learn the preprocessor and about our head
We'll meet you in the next video, till that time, thank you so much.
Very happy 😄😁
Very happy and greatful, thank you , great course.
Super for poor students to learn software course languages TQ