Sunday, February 5, 2012

What is the meaning of #include ?

If a line starts with a hash, denoted by #, kit tells the compiler that a command should be sent to the C PREPROCESSOR. The C preprocessor is a program that is run before compilation takes place ( hence the name). 

Basically, when the preprocessor finds #include it looks for the file specified and replaces #include with the contents of that file. This makes the code more readable and easier to maintain if you needed to use common library functions.

Header files have the extension .h and the full filename follows from the #include directive . They contain functions that you may or may not have used in your program.

for e.g, the stdio.h file is required if you have used functions like printf() and scanf() in your program.

No comments:

Post a Comment