Header Files
What is Header File?
Header files are helping file of your C program which holds the definitions of various
functions and their associated variables that needs to be imported into your C program
with the help of pre-processor #include statement. All the header file have a '.h' an
extensions.
The header files can be requested using the preprocessor directive #include. The
default header file that comes with the C compiler is the stdio.h including a header file
means that using the content of header file in your source program.
Syntax:
#include <file>
Some Header Files
STANDARD INPUT/OUTPUT FUNCTION (STDIO.H)
Function Description
scanf read character, string, numeric data from a keyboard
print the “character, string, float, integer, octal and
printf
hexadecimal values” onto the output screen
reads a character from the terminal and returns it as an
getchar
integer
putchar displays the character passed to it on the screen
gets reads a line from stdin(standard input) into the buffer
puts writes the string str and a trailing newline to stdout.
C STRING CHARACTER FUNCTIONS(STRING.H)
Function Description
strcat concatenate two strings.
strcmp compare two strings.
strcpy copy a string.
strlen get string length.
strncat concatenate one string with part of another.
strncmp compare parts of two strings.
C TIME DATE LOCALIZATION FUNCTIONS
Function Description
clock get current system time
ctime return string that contains date and time information
difftime get the difference between two given times
getdate get the CPU time
setdate modify the system date