C Programming - C Preprocessor - Discussion

Discussion Forum : C Preprocessor - General Questions (Q.No. 2)
2.
In which stage the following code
#include<stdio.h>
gets replaced by the contents of the file stdio.h
During editing
During linking
During execution
During preprocessing
Answer: Option
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.

Discussion:
8 comments Page 1 of 1.

Sandhya said:   1 decade ago
#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:   1 decade ago
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.

Shankra said:   1 decade ago
Thanks sanhya.

Aditya Sant said:   1 decade ago
I thought Linking libraries is done at Linking. whats the fact? what is done at the time of linking?

Yojan said:   9 years ago
I am also having doubt. What will happen during linking? Whether there is linking of called and calling functions?

Dnyaneshwar said:   9 years ago
This is right when we compile the program in the time of period compiler find the libraries to check the code if it is correct or not after that program is ready to give the output when it correctly compile.

Kavi said:   8 years ago
I am also having doubt. What will happen during linking? Whether there is linking of called and calling functions?

Manisha said:   6 years ago
The printf, scanf all those functions in stdio.h get replaced during linking but why the answer is preprocessing?

The preprocessing is all about the replacement of macros, file inclusion, #undef, #if, #endif. Etc.

Can anyone please explain the reason for the answer?

Post your comments here:

Your comments will be displayed after verification.