Header file
|
Introduction
|
The C provides a large number of C
functions as libraries. Some of these implement frequently used operations,
while others are very specialized in their application.
|
Wise programmers will check whether a
library function is available to perform a task before writing their own
version.
|
This will reduce program development
time. The library functions have been tested, so they are more likely to be
correct than any function which the programmer might write.
|
This will save time when debugging
the program. For using these files ,certain files are needed to be included
in the program which make call to these functions.
|
These files are known as Header
files and they contain macro definition ,type
definition, and function declarations.
|
These header files usually have an
extension .h as stdio.h, ctype.h, string.h, math.h, stdlib.h,
stdarg.h, time.h etc.
|
Use of library functions
|
To use a function, ensure that you
have made the required #includes in your C file. Then the
function can be called as though you had defined it yourself.
|
It is important to ensure that your
arguments have the expected types; otherwise the function will probably
produce strange results.
|
Some libraries require extra options
before the compiler can support their use.
|
For example, to compile a program
including functions from the math.h library the command
might be cc mathprog.c -o mathprog –lm
|
The final -lm is an
instruction to link the maths library with the program. The manual page for
each function will usually inform you if any special compiler flags are
required.
|
Some Useful library functions
|
||||||||||||||||||||||||
There is a vast collections of function
.Some of them are grouped together and listed below.
|
||||||||||||||||||||||||
String Function:
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Mathematical Function:
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Date & Time Function:
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Utility Function:
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Character Class Test Functions:
|
||||||||||||||||||||||||
|