The three most important header files are given below.
1. stdio.h
This file helps your program talk to the user.
- You use it when you want to show messages on the screen or get input from the keyboard.
- It gives you tools like:
printf()
– to print textscanf()
– to read what the user types
Example:
If you want the computer to say:
“Enter your name:”
and wait for the user to type something, you use stdio.h
.
2. conio.h
This file helps your program work with the keyboard and screen in a more direct way.
- It gives tools like:
getch()
– waits for a key press (but doesn’t show what was typed)clrscr()
– clears the screen
This is used in old C compilers like Turbo C.
It does not work in most new compilers like GCC.
3. math.h
This file helps your program do math.
- It gives you functions like:
sqrt()
– to find the square rootpow()
– to do power (like 2 to the power 3 = 8)sin()
,cos()
– for angles and trigonometry
Example:
If you want the computer to solve √49, you use math.h
and sqrt(49)
.