Home>Article>Backend Development> What does a C language source program consist of?

What does a C language source program consist of?

藏色散人
藏色散人 Original
2020-04-17 11:35:39 22975browse

What does a C language source program consist of?

What does a C language source program consist of?

At least one C language source program has a main function. To define a function, you must specify 4 elements: return type, function name, formal parameter list in parentheses (may be empty), and function body. Structural characteristics of the source program:

Recommendation: "c Language Tutorial"

1. A C language source program can be composed of one or more source files.

2. Each source file can be composed of one or more functions.

3. No matter how many files a source program consists of, there is one and only one main function, that is, the main function.

4. There can be preprocessing commands in the source program (the include command is only one of them). Preprocessing commands should usually be placed at the front of the source file or source program.

5. Every description and every statement must end with a semicolon. However, semicolons cannot be added after preprocessing commands, function headers and curly braces "}".

6. Identifiers and keywords must be separated by at least one space. If there are obvious separators, you can no longer add spaces to separate them.

7. In C language, there is a set of related control statements to implement selection structures and loop structures: selection control statements: if; switch, case. Loop control statements: for, while, do...while. Transfer control statements: break, continue, goto.

The above is the detailed content of What does a C language source program consist of?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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