Introduction to header files in C language and introduction to C Language

Source: Internet
Author: User
Tags constant definition processing instruction

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.