C++ is pronounced “C Plus Plus”, short for “C Plus Plus”. As the name implies, C++ is based on THE C language to add new features, play new tricks, so called “C Plus Plus”, just like iPhone 6S and iPhone 6, Win10 and Win7 relationship.
Syntactically, C language is a part of C++, and C language code can be compiled in C++ mode almost without modification. This has brought a lot of confusion to many beginners. Should we learn C language first before learning C++?
I’m neutral on this issue, but it’s hard for beginners to learn C++ directly, especially if they don’t have a good understanding of computer memory. C++ is a flexible, feature-rich language, but it can also be complex and difficult to master.
But let’s be clear: learning C is half of learning C++. When you switch from C to C++, you don’t have to start all over again.
C++ and C language blood relationship
Now it seems that C++ and C are two separate languages, but they have an inextricable relationship.
In the early days it was not called C++, but C with classes. “C with Classes” appears as an extension and complement to THE C language, adding many new syntax to make development more efficient, and if you have Java Web development experience, you can compare their relationship to that of servlets and JSPS.
C++ at this time was very crude, supporting only simple object-oriented programming, and did not have its own compiler. Instead, a preprocessor called CFront “translated” C++ code into C code, which was then synthesized into the final program by the C compiler.
With the popularity of C++, its syntax has become more and more powerful, and it has been able to fully support procedural programming, object-oriented programming (OOP) and generic programming, almost a separate language, with its own compilation method.
It’s hard to say that C++ has a standalone compiler, such as the Microsoft compiler for Windows (cl.exe), the GCC compiler for Linux, the Clang compiler for Mac (already the default compiler for Xcode, with ambitions to surpass GCC), They support both C and C++ and are collectively known as C/C++ compilers. For C code, they compile as C does; For C++ code, compile as C++ would.
On the face of it, C and C++ code are compiled using the same compiler, so we said “late C++ has its own compiler” rather than “C++ has a separate compiler”.
Writing a C++ book for readers without any programming experience would be quite a task, and the resulting book would be quite thick. And even then, it’s just grammar.
What’s more, it’s hard for you to absorb all the knowledge, which will severely hit your confidence and lose your interest in learning.
My advice
For readers without any programming background, I suggest starting with C linguistics and not biting off more than you can chew. For readers with programming background, trust yourself to make the right judgment.
Learning to program is a gradual process; don’t expect to get fat all at once. Learning C language, on the one hand, is to learn its syntax, to lay a foundation for C++, at the same time to develop programming interest, and on the other hand, is to learn memory, compilation and linking, to understand the internal mechanism of programming language.
Every beginner has experienced this dilemma: you’ve learned the syntax, you’ve understood what the programming language is all about, you’ve done a lot of coding according to the tutorial, but when it comes to practical problems, you’re stuck, you don’t know where to start. To put it bluntly, you can only learn but not use.
Investigate its reason, is practice little, did not develop programming thinking! Knowledge is easy to learn, but hard to use!
Once you’re familiar with C and can write hundreds of lines of code, you’ll have some idea of how to program. At this time to understand what C++ on the basis of C language added, you will stand in a certain height.
From an “academic” point of view, C++ supports procedural, object-oriented, and generic programming, while C only supports procedural programming. C++ and C are pretty much the same in terms of procedural programming, so if you learn C, you learn half of C++ and you don’t have to start all over again.
Finally, when you encounter problems, it is also very important to ask big gods. It is suggested to chat with this group and discuss with seniors. You will also get a lot of help. Can also exchange learning experience, technical problems, you can get PDF books source code, tutorials and so on for free use