Thursday, July 9, 2009

What does #include do in C?

It is used to call in a library and then you can use the commands in the specified library to write a code.

What does #include do in C?
#include is a directive means it will call perticular header file in c programming.





There are lots of in build header sile to make c language easier. The header files contains the in build function like maths functions , string functions and many more. And to call that functions you need a perticular header file and that should be in c compiler or interpriter.





And #include %26lt; Header file name %26gt; will link that header file to your program and then you can use that in build functions in your program.





I think this is enough for you.


If you wanna know more than mail me.





ankit_upadhyay2020@yahoo.com
Reply:This is a directive to the preprocessor, which runs when you call your compiler. This specific directive causes the file named after the word include to be read in, as if it were typed in at that location in your source code
Reply:In C commands like printf(); scanf(); are defined in another file. To access them you will need to inclucde that file in your program. (Thats why you don't see them turning color when typed whereas predefined commands like int char change color as soon as they are typed) These printf and scanf are in a file called stdio.h (Standard Input/Output). Functions like getch are in conio.h . Therefore to access printf you will need to include the file stdio.h using:





#include %26lt;stdio.h%26gt;
Reply:its main purpose is to include a library file which includes functions which u are/want to use in your current C program. all those functions are defined in that library file... u can also create ur own collection of functions in one file and include that to referr in other programs in the same fashion.





i hope ur question is answered...


No comments:

Post a Comment