C language: what is a header file


Before the header file , we can often see #include at the beginning of a program, which is stdio.h. This is a file named stdio with a .h suffix. In fact, it is no different from the txt text file we use daily , Are all characters that we can understand, but only in English. If you don’t believe it, you can find it. Take VC6 as an example, you can find the VC6.0 full green version of the VC6 compiler in the \VC98\Include\ directory, and you can see it To the stdio.h file.
printf does not belong to the C language itself, and it is defined by adding #include<stdio.h>. Because there is a definition of printf in the header file stdio.h, you can search for printf after opening stdio.h.
Looking at how a C language "includes" these header files, the answer is the #include preprocessing command! The so-called preprocessing means that you can do some preparatory work before the compiler compiles, such as macro replacement, expansion, etc., and the inclusion of the header file is actually to put the content of the header file intact at the end of the program. front.
And our most common <stdio.h> is the input and output function, because most programs can be called programs because they have output, so you can often see it, and it contains printf and scanf.

Guess you like

Origin blog.csdn.net/m0_52405419/article/details/115331474