C language is a powerful professional programming language, which is very popular among amateur and professional programmers.
1.1 Origin
In 1972, Bell Labs developed C, a language developed for programmers.
1.2 reason for use
1. The only way to C ++.
2. It is a modern language that integrates control features.
3. Efficient, portable, powerful, and flexible.
4. For the needs of programmers, it allows access to hardware and can manipulate the special location in memory ., Rich operators.
Disadvantages
1.3 Development Direction
C ++ graft object-oriented programming tools into C language. The former is almost a superset of the latter, and C is almost an effective c ++ program.
C has become popular in programming embedded systems.
1.4 basic principles of computer work
CPU: a central processing unit that is responsible for most of the computing work.
RAM: Random Access to memory. It is used as a workspace to store programs and files.
Permanent storage: Hard Disks are used to write down programs and files even when the computer is shut down.
Peripheral Device: Provides communication between people and computers.
CPU Workflow
The cpu obtains and executes a command from the memory, and then obtains and executes the next command from the memory.
1. Everything stored in the computer is a number.
2. The computer program must end with this digital instruction code.
1.5 advanced computer language and Compiler
A compiler is a program that translates a high-level language program into a detailed machine language instruction set required by a computer. Advanced languages describe actions in a more abstract way.
1.6 use C LanguageSeven steps
Step 1: Define the program target
There is a clear idea about what programs do.
Step 2: design the program
Use pseudocode to describe the program and determine the user interface and data organization mode.
Step 3: write code
Step 4: Compile
The source code is converted to executable code, and the compiler also adds code to the final program from the C library. Finally, an executable file containing computer-understandable code that you can run is formed. In addition, the compiler will check the program error report to you.
Step 5: run the program
Step 6: Test and debug the program
Step 7: maintain and modify programs
1.7 Programming Mechanism
The program content written in c language is stored in a text file called a source code file whose name ends with. c.
C converts source code files into executable files in two steps: Compilation and linking, which facilitates modularization.
The compiler converts source code to intermediate code. The linker combines intermediate code with other code to generate executable files.
There are multiple options. The most common choice is to convert the source code into the machine language code and place the result in a target code file. However, some elements are missing and cannot be executed.
The first element: It is equivalent to your program and OS interfaces.
The second element: the Library file contains the target code of many functions.
The function of the linker is to combine the three and store them in a single file to execute the file.
Run the C program in unix
In Unix systems, write programs in the vi editor and save them. c file, such as test. c, and then cc test. c generate. the out file can be viewed using the ls command. If it is not in the/directory, run it. Otherwise, an error is prompted ,.
If you want to save the executable file, you must rename it. Otherwise, the file will be replaced by a new a. out generated during the next compilation.
In Windows integrated development environment-IDE, if you need to suspend the program, you can add a row of getchar ();
1.8 language standards
1978 K & r c or classic C
1989/90 C89/C90 or ANSI C
1994-1999 C99
Chapter 1 OVER!