Introduction to header files in C language and introduction to C Language
1. # include
First, include is a pre-processing instruction in C language. It is used to copy all the content of the subsequent file to the current source file. Generally, the header file provides the type, constant definition, and function declaration.
Secondly, these types and constants can be used only after the header file is referenced. Function declaration is used to check whether function calls are standardized. If a clear function declaration is provided and an error is called (the number of input parameters is incorrect or the type is incorrect), the compiler reports an error. If no declaration is provided, when an error is called, the compiler only generates a warning.
Finally, stdlib. h contains some common library functions in C language.
Such as dynamic memory-related malloc, realloc, zarloc, calloc, and free.
Rand and srand related to random numbers.
System, getenv, and setenv.
String to numeric functions, atoi, atof, strtoul, etc.
If the function or macro definition in this header file is called in the code, you need to reference this header file.
2. # include "stdio. h"
Header file, which contains the meaning of the stdio. h header file
Include is called the file inclusion command, which means to include the file specified in the angle brackets "" or quotation marks <> into this program and become part of this program. The contained file is generally provided by the system, and its extension is. h. Therefore, it is also called a header file or a header file. The header file of C language includes the function prototype of each standard library function.
Stdio stands for standard input output, meaning "standard input and output". Generally, the input functions scanf are used, and the output functions printf, scanf, and printf are standard input and output functions, the header file is stdio. h. Before the main function, use the include command to include stdio. h file.