C Preprocessor Question:

Download Job Interview Questions and Answers PDF

Can a file other than a .h file be included with #include?

C Preprocessor Interview Question
C Preprocessor Interview Question

Answer:

The preprocessor will include whatever file you specify in your #include statement. Therefore, if you have the line
#include <macros.inc>
in your program, the file macros.inc will be included in your precompiled program. It is, however, unusual programming practice to put any file that does not have a .h or .hpp extension in an #include statement. You should always put a .h extension on any of your C files you are going to include. This method makes it easier for you and others to identify which files are being used for preprocessing purposes.</macros.inc>

Download C Preprocessor Interview Questions And Answers PDF

Previous QuestionNext Question
What are the advantages of using macro?What are # Preprocessor operator in C?