What is difference between Pre processor directory and Header file?
Header files:
Header files are some files which is not the part of C/C++ compiler and contain some functions and classes which can be used by our program. For example “math.h” is a header file which contain mathematical functions like cos(), sin(), sqrt() etc. now if we need to use these functions in our own program we must add “math.h” file in our program.
Preprocessor Directives:
Preprocessor directives are commands which execute before the compilation of our source program. These commands (directives) start from # character. For example “include” is a preprocessor directive which is used to include a header file in our source program, similarly each command (preprocessor directive) has its own function.
Header files are some files which is not the part of C/C++ compiler and contain some functions and classes which can be used by our program. For example “math.h” is a header file which contain mathematical functions like cos(), sin(), sqrt() etc. now if we need to use these functions in our own program we must add “math.h” file in our program.
Preprocessor Directives:
Preprocessor directives are commands which execute before the compilation of our source program. These commands (directives) start from # character. For example “include” is a preprocessor directive which is used to include a header file in our source program, similarly each command (preprocessor directive) has its own function.
Difference in Preprocessor and Header file?
Reviewed by MCH
on
December 21, 2012
Rating:
No comments: