Header files or Libraries (as they are commonly known as) extends the Languages's functionality..C Language supports only the most basic features that it needs.C language does not even contain functions to read from the keyboard and write to the screen. such extended functionalities are written by programmers and are placed in Header files which are reusable.Header files help you to split up your program into modules.
How to include header files in your program? (only for beginner level)
The statement you always write in your c program at the beggining.
yaa.. you are actully including the header files.
we use preprocessor directives or commands which starts with #.
syntax : #include<header file name . h>
why we include header files such as stdio and conio? (conio not for linux)
stdio.h:
Most of the C input/output functions are defined in stdio.h.It is a part of the Standard C Library
refer the header file for the list of available functions.the most commonly used are printf,scanf.
conio.h:
conio.h is a C header file used in MS-DOS compilers for
performing "console input and output" from a program.It is not a part of
the Standard C library.Compilers that target non-DOS operating systems,
such as Linux,Win32 do not support this header file.
beside these, the Standard C Library contains a large number of
functions for tasks like string handling, mathematical computations,
input/output processing, memory allocation and several other operating
system services.
If you are using turbo c++ compiler you can see the header files with the function present in that header file in help section.
Here I m providing small list of usefull header files.
math.h it provides many useful functions such as cos,sin...,log,mod,pow etc.
string.h it provides many string handling functions to compare,concatenate strings,to find their length
we will see this deeply later on.
malloc/calloc for allocating memories and for memory manegment functions.
stdlib.h this header file has variety of different methods.
In short we use header files so that we can use in-built functions.
In further sections, We'll see how to create your own header files.Till then enjoy using the in-built ones.
Comments
Post a Comment