C language characteristics

xiaoxiao2021-03-06  24

The C language is actually not a rigorous statement. But in fact, the popular C #, Java, C , etc. are indeed similar in grammar. In order to reflect the "inheritance and derived" thought, I also summarize the most basic common in grammar in the syntax for the so-called "C language feature" in a few languages.

Turning now to the first characteristics of the C language: functionalized language style. Let's talk about what is a function. In the form of a function of the mathematical function, there is an algebra of unknown, such as Y = X 1. This is a binary equation that is written in the form of "function" in mathematical: y = f (x). As long as you give x a specific value, we can get a specific function value Y. In essence, the operation of the function is a process of "providing a value, the other corresponding value", which is consistent with the "providing data, acquisition result" required by the program design. That is to say, we can use the programming language to represent this function. In the C language, y = x 1 can be represented (assuming x is an integer): int F (int x) {int y; y = x 1; returnix y;} For friends who have not contacted C language It will be necessary to explain it here. This function translates with our language is: Returns an integer function function name "F" (needed to bring an integer X) is {establish an integer variable y; add the value of X to Y; Take the value of Y as a function value;} In a C language, the program is made up of such a function. Such a function structure is:

Return Type Function Name (Parameters) {Function}

It is easy to see that due to this style, C language is born for modular programming ideas (perhaps the C language is to be born in order to program habits of order procedures). However, it is important to note that the function here can not only make mathematical operations, but also enable system functions by calling other underlying functions, such as displaying, printing. The functions can be referenced to each other, but they are kept independent. A function is a whole, even if you call other functions, just care about the operations provided by other functions, except that each function is not coherent. Therefore, all functions are flat, except for a special function - the main function.

What is the main function?

Void main () {}

This is a master. When the program runs, the first execution is the function called "main" "main" or "WinMain" under Windows). Just add code in this function's curly braces, the program will operate according to the code or call other functions. The main function is required, it is like a map and task table. Computers must look at this map to call system resources to look at the task table to complete the task.

Most of the members of the C language also have a feature: pointer support.

To understand what is a pointer, first understand the variable. In the programming language, everything has a certain amount of a certain value called constant, no number, can be changed at any time, called a variable (that is, math unknown). In the example "F (INT X) function," Y "in the curly bracket is a variable. Its previous "int" means that this variable can be used to store an integer. In fact, a variable is a memory space. For example, the Y variable of this plastic is representative of a piece of memory that is sufficient to store an integer, and the access to Y in the function content is actually operated on this space. Since it is the memory "space", as the name suggests can be used to put things. In addition, each space has a "number" called "memory address". The memory address is a determined value, so we can certainly store this value in another variable. This "another variable", that is, the variable stored in the memory address is the so-called "pointer". A pointer points to a memory space, is a variable stores an address of a memory space. That's what I mean. The use of the pointer can be convenient to position, which is reflected in future programming.

The most important part of all programming languages: Judging and loop.

May first explain a little, in fact, the number of computer readings will also be added, and there is no other book in nature other than this computer. The computer can do much more than these things, how did it do?

Answer: Judgment and loop. Therefore, skilled let the computer judges, and do the loop is the true programs the most important work.

In the C language, you can use two statements to make your computer to make judgments. One is IF, the other is SWICH. Do a loop with for, do or do while.

The above is that I think something should be emphasized. Specific grammar, function usage, I will specifically draw a table.

转载请注明原文地址:https://www.9cbs.com/read-42589.html

New Post(0)