Home>Article>Backend Development> What are the basic components of a c program?

What are the basic components of a c program?

藏色散人
藏色散人 Original
2020-04-20 10:08:02 10081browse

What are the basic components of a c program?

#What are the basic components of a c program?

The basic unit of a C program is a function, not a C statement. The language is provided to users in the form of functions. These functions can be easily called and have a variety of loops and conditional statements to control the flow of the program, thus making the program completely structured.

Recommendation: "c Language Tutorial"

C programming language is a structural language. Its distinctive feature is the separation of code and data, that is, each part of the program except necessary independent of each other except for information exchange.

C language has the characteristics of both a high-level language and an assembly language; it is both a successful system design language and a practical programming language; it can be used to write applications that do not rely on computer hardware. Programs can be used to write various system programs.

Extended information:

Function in C program

C program is composed of a set of variables or external objects of the function. A function is a self-contained execution code segment that performs certain related functions. We can think of a function as a "black box". You only need to send data into it to get the result. However, how the function works inside is unknown to the external program.

What the external program knows is limited to what is input to the function and what the function outputs. Functions provide a means of programming programs that are easy to read, write, understand, troubleshoot, modify, and maintain.

The number of functions in a C program is actually unlimited. If there is any restriction, it is that there must be at least one function in a C program, and one and only one of them must start with main. For the name, this function is called the main function, and the entire program starts executing from this main function.

C language programs encourage and encourage people to divide a large problem into sub-problems and compile a function corresponding to solving a sub-problem. Therefore, C language programs generally consist of a large number of small functions rather than a small number of large functions. It is composed of functions, which is the so-called "small functions constitute a large program".

The advantage of this is that each part is fully independent of each other and has a single task. Therefore, these fully independent small modules can also be used as small "components" with fixed specifications to form new large programs.

Over the years of the development of C language, there are a vast number of systems and programs developed in C language. During the development, many library functions that can be used directly have also been accumulated.

The above is the detailed content of What are the basic components of a c program?. 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