[C language tutorial] II (2) a C language program substantially mechanism

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤ micro-channel public number: to dare (WeiGanTechnologies)
➤ blog Park address: San-ching Wing Chi ( https://www.cnblogs.com/strengthen/ )
➤GitHub address: https://github.com/strengthen/LeetCode
➤ original address: HTTPS: //www.cnblogs. com / strengthen / p / 11416899.html 
➤ If the address is not a link blog Park Yong Shan Chi, it may be crawling author of the article.
➤ text has been modified update! Click strongly recommended that the original address read! Support authors! Support the original!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

By the time the exchange found that many couples tend to see the first C program to crash, such as helloworld, many newcomers will feel why a program to output helloword of how there are so many lines of code? Various symbols together mess is what the hell? 

In order to facilitate a common understanding of science and engineering beginner C program, I summed up a universal formula for everyone: 

C = main program function + m * + n * custom function file contains 
(where m, n are 0 or greater)

(PS: Strictly speaking, though definitely not enough, for example, as well as global variables and external dependencies and so on, but the common basic beginner like this)

As can be seen from the formula a C program must have one and only one primary function, since the main function is the entry point and the end point C program. The files contain custom functions and can not, for example, the following procedure:

1 int main()
2 {
3     int a=1,b=2,c=2;
4     c = a+b;
5     return 0;
6 }
7  

This is only one example of a main function, and does not require any headers contain. Of course, m and n can have a lot, and if:

 1 #include<stdio.h>
 2 #include<conio.h>
 3 #include<string.h>
 4 #include<malloc.h>
 5  
 6 int fun1()
 7 {
 8     return 0;
 9 }
10 int fun2()
11 {
12     return 0;
13 }        
14 int main()
15 {
16     return 0;
17 }

Beginners can compare their own formula, m and n is the number, etc., to deepen understanding of the program structure, this way, we can start with beginner structural point of view one two three out.

Guess you like

Origin www.cnblogs.com/strengthen/p/11416899.html