Are #include and #define C statements?

烟雨青岚
Release: 2020-07-03 16:23:43
Original
6136 people have browsed it

#include and #define are not C statements. In C language, only those ending with a semicolon (;) are regarded as C statements; "#" represents a preprocessing macro. #include and #define do not participate in compilation, but the source code is processed before the compiler compiles the source code. Processing adjustments.

Are #include and #define C statements?

include and #define are not C statements.

Only those ending with semicolon; are regarded as C statements.

#include and #define do not participate in compilation, but are processed by the preprocessor.

Among them, #include The preprocessor is responsible for introducing the content introduced by file into the current file, which is just a simple expansion.

#define A B simply replaces the occurrences of A with B in the file.

# represents preprocessing macros. These statements are not compiled into machine code for execution. Instead, the source code is processed and adjusted before the compiler compiles the source code.

For example, #define a 1 defines a constant, which is actually equivalent to the compiler replacing all corresponding constant symbols with constant values ​​before compilation. Where a appears in all programs, the compiler replaces it with 1. There is no variable a involved in the actual running process.

Recommended tutorial: "C Language"

The above is the detailed content of Are #include and #define C statements?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!