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.

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?

Kavi said:   8 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.

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

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?

Shankra said:   1 decade ago
Thanks sanhya.

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.

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.

Post your comments here:

Your comments will be displayed after verification.