A header file in C is a file with a '.h' extension that contains declarations for functions, macros, constants and sometimes data types that can be shared across multiple source files.
Preprocessor Directive is a line in a program that is not a programming statement but actually a command for preprocessor.
For Example:-
#inlude
#define
In this command # is a preprocessor and include is a macro.
There are mainly two types of Header files
1. predefined Header Files
These are the type of header files provided by C standard library which contain declaration for inbuilt functions.
2. User-defined Header Files
These are the type of Header files that a programmer can create and use in there specific projects. Including declarations for functions, macros, constants, and custom data types.
There are Mainly 2 ways to declare header files
For creating a user defined Header file, just create a file with .h file type and some functions inside that file and save it in either your local folder or c language system directories.
To call that header file use the preprocessor directive #include and then name of the header file in double quotes.
And then You can use your own functions from your own header file without creating it inside that program.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3