Why learning and using C language ?, Language

Source: Internet
Author: User

Why learning and using C language ?, Language

I. Preface

For science and engineering students, this answer may be simple because it is a required course. For programmers, choosing a programming language has a significant impact on their career development to some extent. Therefore, they must be cautious. So why choose a language that has been born for nearly half a century? This article is not a conventional nonsense, such as: "C language is the foundation of programming", "learning C language well, not afraid to go all over the world", etc. This article strives to answer this question in detail and properly, this article aims to become the best article on why to learn and use C.

 

II. C Language

C language is developed by Dennis Ritchie, a researcher at the AT&T Bell laboratory in the United States. Based on B language, C language was initially used as a development language for transforming Unix operating systems and became popular with the rise of Unix operating systems. Later, with the development of micro-computers, C began to be transplanted to other operating system platforms and become an independent programming language.

From the Tianyi programming language ranking list, C has been dominant in the past 30 years and is occasionally surpassed by Java:

So is learning and using a language that has always been the first in the ranking? Obviously not, the cloud is a taboo for programmers. The labels created for the operating system are doomed to be mediocre. To be honest, C is a programming language that is hard to learn and use, without the basic knowledge of compilation principles, operating systems, and computer architecture, it is impossible to understand and use C. C, as a highly practical engineering language, provides precise control over the operating system and memory, a high-performance runtime environment, and source code-level cross-platform compilation, this is why we must learn and use C.

Fortunately, C is also an interesting thing. The deeper the cognition of programming, the more interesting it will be. I will briefly list some advantages of C:

2.1) structured design language with clear syntax and simple structure. modularization makes all parts of the program independent from each other except necessary information exchange, facilitating development, debugging and debugging.
2.2) There are many operators, and brackets, value assignment, and forced type conversion are all processed as operators. flexible use of various operators can greatly improve programming efficiency.
2.3) the data structure is rich, and various complex data types can be computed. The introduction of pointer and struct Concepts makes the program more efficient.
2.4) born for the operating system, you can perform operations on the position, byte, and address in the same way as the assembly language, and allow direct access to the physical address to operate on the hardware, combine the basic structure and statements of advanced languages with the practicability of low-level languages.
2.5) High program execution efficiency, generally 10% ~ 20%.
2.6) Good portability. C language abstracts the details of CPU programming and can be widely used in writing large operating systems and system software.
2.7) with powerful drawing functions, like C ++, you can write elegant 2D, 3D graphics and animations.

Some people say that C is a subset of C ++, and C can do the same thing, and it can do better, such: three main object-oriented features and GUI programming are true. I admit that C ++ occupies an absolute dominance in the GUI programming field, and no one can shake it up till now. But is it really necessary to replace C ++ with C to complete the work? In many cases, is the idea of C ++ solving problems more advanced than C?

  

Iii. Comparison between C and C ++

When I wrote this section, I felt like a treasure. After all, C and C ++ are very familiar to many programmers, and it is extremely scary to blow up their mouths, in fact, there is no end to debate on the issue of faith, and it is meaningless. I hope that you will not put a lot of energy into arguing over the advantages and disadvantages of pure language, but think about how to do things right and do things right-fast and efficient development, it ensures fast and stable operation and fast and simple maintenance.

Linus Torvalds attacked C ++ and the c ++ programmers around him. In fact, I personally do not like Linus's personal style, I still hope you can talk about the advantages and status quo of C compared with C ++:

3.1) Implicit operation: C is simple and straightforward, and the structure is clear. Each line of code can be compiled into a corresponding statement, and the system will strictly follow your code. C ++ is not the case. A simple statement cannot tell exactly how many constructor and copy operations are performed. Therefore, it is impossible to write the underlying code, and the underlying layer must be accurate and strictly controlled.

3.2) Language Interface: the development of modern software engineering projects not only has high performance requirements, but also has high requirements on the ability to connect language interfaces, because a large project in idea rarely uses only one language for development, C ++ has less precise control over Memory and hardware than C at the underlying layer. For many dynamic languages and middleware, for example, PHP, Python, Apache, and Redis are all greatly affected by C, and even the things developed by C are very convenient to connect. There is no error. In fact, C ++ can be connected in a roundabout way. However, it is far less convenient than C, and the development and maintenance costs are very high. 3.3) hardware layer: 3.2.1> memory allocation: After the system is powered on, it runs. After the Assembly initialization stack, it jumps to the start_init () function in C, at this time, the memory allocation mechanism has not yet been established. How does C ++ define classes? How to instantiate an object? 3.2.2> standard library dependency: all features of C can be run independently of any database. If necessary, you can compile your own library according to specific requirements. 3.2.3> compatible processors: C ++ classes are addressing based on base addresses and offset addresses. Many microprocessors only have simple addressing for given addresses, the addressing mechanism of base + offset is not supported for one statement. Many C ++ code compilation requires more commands to calculate the address, resulting in too much performance degradation. 3.4) Application Layer: C ++ is working on the application layer, especially GUI programming. This is a traditional strength of C ++. I have always insisted that C can also make images and animations elegantly, however, the development efficiency is indeed much lower than that of C ++. Recently, there is a very popular RUST language, which claims to be the only programming language that can replace C ++ in the future, if you are interested, you can pay more attention to it. Iv. Below I will list more than 10 popular development directions and give a rough introduction to the most common programming languages in the following projects, basic knowledge of operating systems, compilation principles, data structures and algorithms is an important prerequisite for in-depth understanding, understanding, and flexible use of C, at this stage, more than half of the programmer's career hotspots are directly or indirectly related to C. I think the importance of C learning is self-evident.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.