search
HomeBackend DevelopmentC#.Net TutorialC language is not simple, even programmers say so, why?

The first language I learned in college was C language. Everyone should be the same as me. Anyone who can use the language professionally should have learned C language. Maybe everyone agrees that C is the most basic and most basic language. It’s simple. Of course you have to learn it first. This is not the case. In fact, many programmers I know complain about how difficult it is to learn C. This is also true. Maybe the syntax of C language is very simple and suitable for beginners to start with. However, if it is used in development, it is extremely complicated. This article will introduce it in detail. apache php mysql

begin!

C language is not simple, even programmers say so, why?

Underlying == Okay?

C language provides low-level operations, such as pointers. But the biggest difference between the C language and C is that the C language cannot avoid pointers, while C uses STL and smart pointer libraries to completely avoid it. In other words, pointers in other languages ​​are just types, and pointers in C language are pointers. I have always believed that it is a taboo for beginners to come into contact with pointers too early. Beginners need to make fun applications that generate immediate feedback, rather than delving into computer systems that will only erode their confidence. Beginners should focus on the code logic and block out everything that deals with the underlying layer. Let’s use an analogy. If you were taught about the periodic law of elements and the VSEPR model when you were just learning chemistry, would you be interested?

Exposing the underlying layer is also harmful from another perspective, which involves manual management of memory in the heap. Computers are about a trade-off. You can say that this method has high execution efficiency, but in most cases, it is wrong to excessively pursue execution efficiency and ignore development efficiency. Manual memory management is a matter for senior programmers. Junior programmers should completely leave it to the features of the language to manage memory. Otherwise, if your program has a null pointer exception in three days and a memory leak in five days, who will suffer? Come on? Therefore, no matter from which point of view, C language is not suitable for getting started.

C language is not simple, even programmers say so, why?

The editor recommends a place with a great learning atmosphere, C/C Communication Penguin Skirt: 341636727! It is suitable for college students and novices who want to change careers and find jobs through this program. There are a lot of learning materials in the skirt, masters answer communication questions, and there are free live broadcast courses every night

There is also a view that only the C language can access the stack and heap models . I am very responsible to tell you that all non-script compiled languages, such as c and swift, as well as managed languages, such as c# and java, can have access to the stack and heap model, and due to the automatic memory management mechanism , the latter uses the heap much more frequently than C. Scripting languages ​​also have their own variable container models, such as PHP's zval. This blame should not be shouldered by programming languages, but by domestic junk textbooks. It can also be seen that the stack model of the C language is not universally applicable. If you apply it to other languages, it may not work. But some people insist on using it as the basis for learning other programming languages, which is really ridiculous.

The price of simplicity

The C language does not provide high-level encapsulation and abstraction of some common components. For example, when using a hash table, you have to build one yourself, or search online to see if there are any ready-made codes. This is very unfriendly to developers. Since there is no such thing in the C language standard library, it will not be mentioned at all when learning. This has led to many people not even knowing that such a thing exists, and they can only stare when they encounter problems. The only containers supported by C language are native arrays, and strings are implemented using native character arrays, so the processing of strings is very, very weak. If you want to write a code for string concatenation, it will take one line in Java and several lines in C language. This is the price of the "simplicity" of the C language.

The simplicity of C language is precisely the result of omitting the native support of OO. Why I mentioned native support above is because C language can still implement OO through combination. For example, inheritance is implemented through combination, virtual functions are implemented using pointer function members, and so on. In terms of OO, C language is much more difficult to implement than C. A keyword in C corresponds to a few lines of code in C language. How can it be said to be simple? Whether OO is good or bad, it is now a common language paradigm in the industry, and its role is just like English in natural language, playing a decisive role. If you don't get in touch with this, you will be at a disadvantage when looking for a job in the future. But is OO really complicated? If you read a Java book, you will spend at most two chapters introducing these things, one chapter is about classes and one chapter is about interfaces. Other languages ​​that are not so OO just spend one chapter, just to tell you that there is a class, and this length is almost the same as the structure and enumeration in the C language tutorial.

The "simplicity" of C language means that in actual development, you need to do more manual operations instead of the compiler. I think God is fair. If he gives other languages ​​​​more language features, he will also give them higher development efficiency.

C language is not simple, even programmers say so, why?

Let’s talk about the standard library

The reason why the C language book is so short is not because there are no OO things, but the standard library It lacks some modern components, these things are all in posix. Talking about C language without posix api is just being a hooligan. There is no shortage of common components or facilities when it comes to the C language. Because of the modern program running environment and requirements, you can't write anything without these things. Of the five major libraries of modern programming languages ​​(strings, containers, io, threads, and networks), the C language only misses two. As for the latter two, C language developers have to use posix api, and then solve the api incompatibility problem. The virtues of the C language standard library are half disabled without posix. And if you want to understand posix, you have to read "apue". If you tell me that C language is simple, tell me it is simple after reading the thick book "apue".

Not a postscript

We learn a programming language not to prepare for exams, but to actually make things. A language like C that has no containers, no strings, no templates, no exceptions, no RAII, all the wheels are made by oneself, and has no features of modern programming languages, is extremely complicated to use. Sorry, I don't have time to study how every feature or class is implemented in C language. I still like to use shorter code to express my logic.

end:

#After reading this, you can see where is simple? Is it easy to write toy programs? Anyway, I think it looks very complicated, and it’s not like what it looked like when I was in college. Maybe I learned a fake C language at that time.

Related articles:

10 C language resources that will make you a better programmer

c language 10 A classic small program

Related videos:

C language tutorial

The above is the detailed content of C language is not simple, even programmers say so, why?. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
C# .NET: An Introduction to the Powerful Programming LanguageC# .NET: An Introduction to the Powerful Programming LanguageApr 22, 2025 am 12:04 AM

The combination of C# and .NET provides developers with a powerful programming environment. 1) C# supports polymorphism and asynchronous programming, 2) .NET provides cross-platform capabilities and concurrent processing mechanisms, which makes them widely used in desktop, web and mobile application development.

.NET Framework vs. C#: Decoding the Terminology.NET Framework vs. C#: Decoding the TerminologyApr 21, 2025 am 12:05 AM

.NETFramework is a software framework, and C# is a programming language. 1..NETFramework provides libraries and services, supporting desktop, web and mobile application development. 2.C# is designed for .NETFramework and supports modern programming functions. 3..NETFramework manages code execution through CLR, and the C# code is compiled into IL and runs by CLR. 4. Use .NETFramework to quickly develop applications, and C# provides advanced functions such as LINQ. 5. Common errors include type conversion and asynchronous programming deadlocks. VisualStudio tools are required for debugging.

Demystifying C# .NET: An Overview for BeginnersDemystifying C# .NET: An Overview for BeginnersApr 20, 2025 am 12:11 AM

C# is a modern, object-oriented programming language developed by Microsoft, and .NET is a development framework provided by Microsoft. C# combines the performance of C and the simplicity of Java, and is suitable for building various applications. The .NET framework supports multiple languages, provides garbage collection mechanisms, and simplifies memory management.

C# and the .NET Runtime: How They Work TogetherC# and the .NET Runtime: How They Work TogetherApr 19, 2025 am 12:04 AM

C# and .NET runtime work closely together to empower developers to efficient, powerful and cross-platform development capabilities. 1) C# is a type-safe and object-oriented programming language designed to integrate seamlessly with the .NET framework. 2) The .NET runtime manages the execution of C# code, provides garbage collection, type safety and other services, and ensures efficient and cross-platform operation.

C# .NET Development: A Beginner's Guide to Getting StartedC# .NET Development: A Beginner's Guide to Getting StartedApr 18, 2025 am 12:17 AM

To start C#.NET development, you need to: 1. Understand the basic knowledge of C# and the core concepts of the .NET framework; 2. Master the basic concepts of variables, data types, control structures, functions and classes; 3. Learn advanced features of C#, such as LINQ and asynchronous programming; 4. Be familiar with debugging techniques and performance optimization methods for common errors. With these steps, you can gradually penetrate the world of C#.NET and write efficient applications.

C# and .NET: Understanding the Relationship Between the TwoC# and .NET: Understanding the Relationship Between the TwoApr 17, 2025 am 12:07 AM

The relationship between C# and .NET is inseparable, but they are not the same thing. C# is a programming language, while .NET is a development platform. C# is used to write code, compile into .NET's intermediate language (IL), and executed by the .NET runtime (CLR).

The Continued Relevance of C# .NET: A Look at Current UsageThe Continued Relevance of C# .NET: A Look at Current UsageApr 16, 2025 am 12:07 AM

C#.NET is still important because it provides powerful tools and libraries that support multiple application development. 1) C# combines .NET framework to make development efficient and convenient. 2) C#'s type safety and garbage collection mechanism enhance its advantages. 3) .NET provides a cross-platform running environment and rich APIs, improving development flexibility.

From Web to Desktop: The Versatility of C# .NETFrom Web to Desktop: The Versatility of C# .NETApr 15, 2025 am 12:07 AM

C#.NETisversatileforbothwebanddesktopdevelopment.1)Forweb,useASP.NETfordynamicapplications.2)Fordesktop,employWindowsFormsorWPFforrichinterfaces.3)UseXamarinforcross-platformdevelopment,enablingcodesharingacrossWindows,macOS,Linux,andmobiledevices.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools