Header files contains declaration of built in functions. Let us see in detail how compiler understands the line :
[edsanimate_start entry_animation_type= “zoomIn” entry_delay= “0” entry_duration= “2” entry_timing= “linear” exit_animation_type= “” exit_delay= “” exit_duration= “” exit_timing= “” animation_repeat= “1” keep= “yes” animate_on= “load” scroll_offset= “” custom_css_class= “”][edsanimate_end]
#include<stdio.h>
Here,
# is a pre-processor directive which tells us that this is the line which must be pre-processed by pre-processor.
include tells us that there is a filename ahead which must be included at the top of our program. Preprocessor simply copies contents of file stdio.h in our code.
<> – Angled brackets informs where to search for header files.
Note: We can create our own header files as well. But they are specified in between double quotes instead of angular brackets.
stdio.h – is the file to be included in our program so that we can use built-in functions in our program. These built-in functions are only declared in such header files and not defined.
Apart from method or class declarations, header files also contains predefined macros, data type definitions, etc.
When you call a built-in function, at compile time compiler compares your calling statement with function prototype(which is in header file) and if the return type, function name, number of arguments, type of arguments are same then only the the result of comparison is said to be satisfying otherwise compiler gives you error/s.
Intro About C :
- The C programming language is a structure oriented programming language, developed at Bell Laboratories in 1972 by Dennis Ritchie.
- C programming language features were derived from an earlier language called “B” (Basic Combined Programming Language – BCPL)
- C language was invented for implementing UNIX operating system
- In 1978, Dennis Ritchie and Brian Kernighan published the first edition “The C Programming Language” and commonly known as K&R C
- In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSI C”, was completed late 1988.
[edsanimate_start entry_animation_type= “fadeInUp” entry_delay= “0.5” entry_duration= “1.5” entry_timing= “linear” exit_animation_type= “” exit_delay= “” exit_duration= “” exit_timing= “” animation_repeat= “1” keep= “yes” animate_on= “scroll” scroll_offset= “5” custom_css_class= “”][edsanimate_end]
What Is Header Files : A header file is a file with extension .h which contains Cfunction declarations and macro definitions to be shared between several source files. There are two types ofheader files: the files that the programmer writes and thefiles that comes with your compiler.
Why We Use Header Files : A header file is generally used to define all of the functions, variables and constants contained in any function library that you might want to use. The header file stdio.h should be used if you want to use the two standard I/O functions printf and scanf.
[edsanimate_start entry_animation_type= “fadeInUp” entry_delay= “0.5” entry_duration= “1.5” entry_timing= “linear” exit_animation_type= “” exit_delay= “” exit_duration= “” exit_timing= “” animation_repeat= “1” keep= “yes” animate_on= “scroll” scroll_offset= “5” custom_css_class= “”][edsanimate_end]
Types Of Header Files :
No. | Name | Description |
1 | stdio.h | Input/Output Functions |
2 | conio.h | console input/output |
3 | assert.h | Diagnostics Functions |
4 | ctype.h | Character Handling Functions |
5 | cocale.h | Localization Functions |
6 | math.h | Mathematics Functions |
7 | setjmp.h | Nonlocal Jump Functions |
8 | signal.h | Signal Handling Functions |
9 | stdarg.h | Variable Argument List Functions |
10 | stdlib.h | General Utility Functions |
11 | string.h | String Functions |
12 | time.h | Date and Time Functions |
13 | complex.h | A set of function for manipulating complex numbers |
14 | stdalign.h | For querying and specifying the alignment of objects |
15 | errno.h | For testing error codes |
16 | locale.h | Defines localization functions |
17 | stdatomic.h | For atomic operations on data shared between threads |
18 | stdnoreturn.h | For specifying non-returning functions |
19 | uchar.h | Types and functions for manipulating Unicode characters |
20 | fenv.h | A set of functions for controlling floating-point environment |
21 | wchar.h | Defines wide string handling functions |
22 | tgmath.h | Type-generic mathematical functions |
23 | stdarg.h | Accessing a varying number of arguments passed to functions |
24 | stdbool.h | Defines a boolean data type |
Header Files Can Find On This Location C:\TurboC++\Disk\TurboC3\INCLUDE
A Short Program To Show The Use Of Header File Is
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, sum;
printf(“Enter The Value Of A = “);
scanf(“%d”,&a);
printf(“\n\nEnter The Value Of B = “);
scanf(“%d”,&b);
sum = a + b;
printf(“Sum Of %d and %d is Equal To %d”,a,b,sum);
getch();
}