C++/printf() and scanf() functions !
Expert: Prince M. Premnath - 7/14/2007
Questionmy question is, where the printf and scanf function will be stored.
AnswerHi dear saranya !
In order to use the functions printf() and scanf() you should have to include the header file stdio.h ( stands fo standard input/output.h )
make sure header files in c will contain only the function prototypes , constants , enumerated values and global variables , same in case of the functions scanf() and printf() only the prototypes of the functions is available in header files !
Why to use header files ?
The statement #include<stdio.h> used in your program , the statement will be replaced with the actual contents of the header file stdio.h , Upon doing like this during compilation , the compiler will make a reference over the functions declared in the header files !
What is library ?
Library is a collections of sub programs that may be used in many programs independently , such sub modules are grouped under the header files for future use ! most of the libraries are not executable , they are only used as a reference .
Reference may take place during compile time or runtime depend upon the nature of the library , the libraries that are linked ( linking is the process of linking the function call associated with code , typically done by the linker )
So the function prototypes are stored in the header files ( ie .h files ) and its actual definition and implementation will be stored in library files ( .lib file )
Thanks and Regards !
Prince M. Premnath