1.1 preliminary understanding of C language
1.2 program and programming language
1: Development of programming language
2: Functions of programming language
3: Program algorithm
1.3 characteristics of C language programming
1.4 editing, compiling, linking and running of C program.
1: In the development of program language, three languages are mentioned,
1. Machine language: binary code composed of 0 and 1 has the highest operating efficiency, but many people choose to give up because of the difficulties in learning, remembering and modifying machine language.
2. Assembly language: the operation instructions use symbols instead of binary. Although it is easy to understand and the operation efficiency is second only to machine language, it is very dependent on the shortcomings such as poor portability of machine hardware, so it is called "low-level language".
3. High level language: its advantages, the operators and operation expressions used are similar to the mathematical expressions used by people in daily life. It is easy to understand. People can use it more effectively and conveniently to compile computer programs for various purposes, which is widely used.
From middle to high level, language has experienced different stages of development
(1) Unstructured language: at this stage of development, the language programming style is relatively random, there is no programming specification to follow, and the process in the program can jump freely, making the program difficult to read and maintain. Example: early FORTRAN ALGOL BASIC
(2) Structured language: in this development stage, the process in the program is not allowed to jump at will. The advantage is that the structured language is adopted, the program structure is clear, easy to read and maintain. Example: QBASIC Pascal and C are structured languages
(3) Object oriented language: the language at this stage of development is also widely used, because programmers not only need to implement the details of each process, but also the program is not easy to repeat. Object is the encapsulation of data and operations on data, so it becomes easier, less time-consuming and more efficient to develop applications by using object-oriented programming method. For example, C++ C# Visual Basic JAVA language
2: Functions of programming language
(1) Definition: programming language must have the ability of data expression (i.e. variable definition) and data processing (i.e. process control)
(2) Data expression: usually, several basic data types are defined in each programming language to define the data used in the program. The data objects that can be defined by data types are expressed in two types: constant and variable. The value of variable can be changed at will, while the value of constant is not changed in the program.
(3) Process control: the control is also divided into three structures
1 sequence control structure: after a statement is executed, the next statement is executed in natural order. The assignment statement, input and output in C language constitute the sequence structure
2 branch control structure: also known as selection structure, computers often need to select and execute different statements according to different conditions when executing programs. For example, if and switch statements in C language can form selection structure
3 loop control structure: loop control is, for example, repeated execution. Repeated execution is generally conditional. When the conditions are met, it will be repeated; when the conditions are not met, it will not be repeated
These three structures have several common characteristics
Only a single entrance and a single exit... 1
Every part of the structure has the possibility of being executed... 2
There should be no endless loop in the structure... 3
3: Algorithmic representation of programs
The main body of the software is the program, and the core of the program is the algorithm.
2. The algorithms designed for different problems are also changeable, but as algorithms, they should have the following five characteristics:
(1) Certainty: each instruction of the algorithm must have a clear meaning without ambiguity. For the same input, the same execution result must be obtained.
(2) Boundedness: an algorithm should contain a limited number of operation steps
(3) Feasibility: the operations specified in the algorithm can be implemented after a limited number of basic operations have been implemented
(4) There are zero or more outputs: the algorithm is used to process data objects. In most cases, these data objects need to be obtained through input.
(5) There are one or more outputs: the purpose of the algorithm is to solve, and the solution can be obtained only by output.
If the solution to a problem cannot be expressed as a computer algorithm, there is nothing the computer can do.
4: There are also many forms of algorithm representation, including text description, flow chart and programming language representation of pseudo code. I can't enumerate these representation methods. Sorry*
The flow chart represents the operation box of high school mathematics.
IV: C Characteristics of language 1 C There are six features in language (1) C The language is concise and compact, easy to use and flexible. (2)Rich operators and strong expression ability. (3) C The language program has good portability. (4)The generated object code has high quality and high efficiency. (5)Strong language processing ability. (6) C Language is a structural language 2 Yes C There are many advantages of language, but C Language also has shortcomings: the main performance is C The language does not strictly check the syntax, and programmers are often required to ensure the correctness of the program, which is difficult for beginners C These advantages and disadvantages of language need to be gradually adapted and experienced in continuous learning and practice. 3 C Language conventions (1)Identifier: C The identifier of a language consists of alphanumeric characters and underscores. The first character must be a letter or an underscore. For example:_00 It should also be noted that the case of Chinese and English letters in the identifier is different. For example name and Name Are different identifiers. The naming of identifiers is best to "see the name and know the meaning" to increase the readability of the program. (2)Keywords: keywords are C An identifier that is specified in the language, gives a specific meaning and has a special purpose C There are 32 keywords in the language. See the following for details. Data type keywords (12): char ， double ，enum ， float ，int，long， signed，struct，union，un-signed void Control statement keywords (12): break，continue，case，do ，default，else，for ，goto，if， return ，switch，while Storage type keywords (4): auto ，extern，register，static Other keywords (4): const，sizeof，typedef，volatile be careful: C Language keywords are written in lowercase letters, not in uppercase letters. int Can't write Ine վ'ᴗ' ի (3)User defined identifier: user defined identifier includes variable name, program type name, function name and symbolic constant name defined in the program. (4)Predefined identifier: C Language provides a large number of header files and library functions. Some identifiers defined in these header files and library functions are collectively referred to as predefined identifiers. (5)Separator: C There are two kinds of separators in languages: comma and space. Commas are mainly used to separate variables in type descriptions and function parameter tables. Spaces are often used as spacers between words. 5: C Grammatical components of language (1)constant (2)variable (3)Operators: operators include arithmetic operators and relational operators. Arithmetic operator:+(Plus),-(Minus), *((by)/(Except),%((remainder) relational operator:>(Greater than),>=(Greater than or equal to),==(Equal to), etc. when participating in the operation, those requiring only one data object are called monocular operators, those requiring two data objects are called binocular operators, and those requiring three data objects are called ternary operators. (4)Expression: a meaningful expression composed of constants, variables and functions by operators is called an expression. (5)Statements: in C In language, a statement is the most basic execution unit of a program, ending with a semicolon. (6)Function definition and call: functions are small modules that complete specific functions C The only subroutine in a language, often in a C The program contains several functions, and complex tasks are completed by calling these functions. (7)Input and output: C Language does not provide statements for data input and output. All input and output are realized through relevant functions provided by the system. 6: The task of programming is the process of solving practical problems by computer, which generally consists of six steps. (1)Analyze problems: before starting to solve problems, we should fully analyze and fully understand the problems, clarify the original data, problem-solving requirements, data and form to be output, etc (2)Design algorithm: the algorithm is a description of the problem solving process and steps (3)Programming: programming is the process of implementing the algorithm designed by a computer language (4)Running and debugging programs: running programs usually includes compiling, linking and other operations. The compiler checks the syntax of language programs. If the compilation sequence passes, the compiler converts the source program into the target program. Most programming languages often use the link program to link the target program with the library file provided by the system, and the final executable file has been obtained; If there is an error in the compilation process, an error prompt message will be given. At this time, the program shall be debugged, and the error of the original program shall be found and corrected before recompiling until there is no syntax error. (5)Analysis of program running results: for programs that have been successfully compiled and linked and finally run smoothly, programmers also need to analyze the program running results. Only the program with the correct results is the correct program (6)Write program documents program documents usually refer to the program operation manual, including program name, program function, operation environment, program operation mode, data required for operation, precautions for use, etc That's what I'm talking about C Language programming is summarized in Chapter 1.(๑ت๑)