In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h
[A].
During editing
[B].
During linking
[C].
During execution
[D].
During preprocessing
Answer: Option A
Explanation:
The preprocessor replaces the line #include <stdio.h> with the system header file of that name. More precisely, the entire text of the file 'stdio.h' replaces the #include directive.
#include is a preprocessor directive(file inclusion)and it includes a file in the program . and as we know that a preprocessor processes our program before execution so the line #include<stdio.h> is replaced by the entire content of the file 'stdio.h' during preprocessing.
Shashank Nalwaya said:
(Mon, Aug 22, 2011 10:21:09 AM)
Here the functioning is similar to macros. What actually happens is that before compilation i.e. preprocessing as in macros the macro template is replaced by the macro expansion and than the compilation takes place similarly in this case during preprocessing the content of the file is replaced by the file name and than the compilation takes place.