Home > Backend Development > C#.Net Tutorial > Features that novices must know when learning C language

Features that novices must know when learning C language

烟雨青岚
Release: 2020-07-07 13:38:19
forward
2260 people have browsed it

Features that novices must know when learning C language

The characteristics of C language can be summarized as follows:

1. C language is concise, compact and flexible.

The core content of C language is very small, with only 32 keywords and 9 control statements; the program writing format is free, and all unnecessary components are compressed.

2. Concise and practical expression.

C language has a set of powerful operators, with 44 types, which can construct various forms of expressions. With one expression, you can achieve functions that may require multiple statements in other languages.

3. Have rich data types.

The more data types there are, the stronger the data’s expressive ability. C language has various data types of modern languages, such as: character type, integer type, real type, array, pointer, structure and union, etc. Various complex data structures such as linked lists, stacks, queues, trees, etc. can be implemented. Pointers make the transfer of parameters simple and fast, saving memory.

4. Has the characteristics of low-level languages.

It has functions and description methods similar to those of assembly language, such as address operations, binary digit operations, etc. It can directly operate resources such as hardware ports and make full use of computer resources.

Therefore, C language not only has the characteristics of a high-level language that is easy to learn and master, but also has the ability to operate hardware with machine language or assembly language. Therefore, C language can be used as both a system description language and a general programming language.

5. is a structured language, suitable for modular design of large programs.

C language provides basic control statements for writing structured programs, such as if~else statements, switch statements, while statements, do~while statements, etc. A C program is a collection of functions. Functions are the basic unit that constitutes a C program. Each function has an independent function, and data is passed between functions through parameters.

In addition to functions written by users, different compilation systems and operating systems also provide a large number of library functions for users to use, such as input and output functions, mathematical functions, string processing functions, etc., and flexible use of libraries Functions simplify program design.

6. Various versions of the compilation system provide preprocessing commands and preprocessor programs.

Preprocessing extends the functions of the C language, improves the portability of the program, and facilitates the debugging of large programs.

7. Good portability.

A program can be transplanted from one environment to run in a completely different environment without or with minor changes. This is because system library functions and preprocessors isolate possible machine-related factors from the source program, making it easy to redefine relevant content between different C compilation systems.

8. The generated target code is of high quality.

The running efficiency of the target code obtained from the C source program is only 10% to 20% lower than that written in assembly language, which can give full play to the efficiency of the machine.

9. C language has loose grammatical restrictions and great freedom in programming.

C programs do not perform checks such as array subscript out-of-bounds and variable type compatibility when running, but the programmer himself ensures the correctness of the program. C language allows conversion of almost all data types. Character types and integer types can be freely mixed. All types can be used as logical types. You can define new types by yourself, and you can also force a certain type to a specified type.

Disadvantages:

1. C program errors are more hidden.

The flexibility of the C language makes it more error-prone when writing programs in it, and the C language compiler does not check for such errors.

Similar to assembly language, these logic errors need to be run before the program can be discovered.

C language also has some hidden dangers that need to be paid attention to by programmers. For example, if the comparison "==" is written as assignment "=", there is no grammatical error. Such logical errors are difficult to find, and it is often very difficult to find them. Time consuming.

2. C programs can sometimes be difficult to understand.

C language has relatively simple grammatical components and is a small language. However, its many data types, rich operators and diverse combinations make it difficult to understand.

Regarding operators and associativity, the most common saying people say is "multiplication and division first, then addition and subtraction, and operations at the same level are from left to right", but the C language is far more complicated than this.

When the C language was invented, in order to reduce character input, the C language was relatively concise, and it also enabled the C language to write programs that were almost incomprehensible to ordinary people.

3. C programs are sometimes difficult to modify.

Considering the increase in program size, modern programming languages ​​usually provide language features such as "classes" and "packages", which can decompose the program into more manageable modules. .

However, C language lacks such features, making it difficult to maintain large programs.

Thank you everyone for reading, I hope you will benefit a lot.

This article is reproduced from: https://tigerisland.blog.csdn.net/article/details/51719922

Recommended tutorial: "C Language"

The above is the detailed content of Features that novices must know when learning C language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template