The C programming language was originally developed for and implemented on the UNIX operating system by Dennis Ritchie. The C language, which is quite simple, is not tied to any particular hardware or system. This makes it easier for a user to write programs that will run without many (or any) changes on practically all machines.
Đang xem: Learn c
The C language is often called a middle-level computer language as it combines the elements of high-level languages with the functionalism of assembly language. C programming allows the manipulation of bits, bytes, and addresses—giving the programmer more control over exactly how the program will behave and more direct access to the mechanics of the underlying hardware.
C was created, influenced, and field-tested by working programmers. The end result is that C gives the programmer what the programmer wants.
C++ is an enhanced version of the C language. C++ includes everything that’s part of C and adds support for object-oriented programming (OOP). In addition, C++ also contains many improvements and features that make it a “better C,” independent of object oriented programming.
The C++ language is actually extensible since we can define new types in such a way that they act just like the predefined types which are part of the standard language.
If you just use C++ as a better C, you will not be using all of its power. Like any quality tool, C++ must be used the way it was designed to be used to exploit its richness. Some of the new features include encapsulation, inline function calls, overloading operators, inheritance, and polymorphism.
C and C++ are still two of the most popular programming languages out there. The syntax and concepts of C, especially, has stood the test of time, and you can see them being carried on to other popular programming languages, even the modern ones, such as Go.
Even if you are going to build web applications or fancy web front-end components for the rest of your life, learning C will help you understand how software and hardware actually interact.
Besides, C and C++ are everywhere.
C in particular powers a lot more technology than we give it credit for.
On the other hand, some of your favorite software – possibly even the web browser you are reading this article on—is built on C++. Knowing C is a good base, but in many cases, software development will require you to learn C++ and its paradigms.
If you want to develop software that needs to make the most out of a computer’s performance and capabilities—high-end desktop games, sophisticated productivity tools, or complex computationally intensive programs, for instance—or if you just want a programming language that lets you interact with a computer’s hardware directly, C and C++ are the languages for you.
So, why would you not want to learn C++ or C? It’s not like 25 years ago, when you might have had to invest in a proprietary compiler to get started—today you can certainly learn C++ free.
To get started with C or C++, what you’ll want in most cases, at the very least, is a compiler—although nowadays you can also learn C online by experimenting a bit with “hello world” C projects in-browser.
Compilers are programs that can be run through command-line interfaces (CLIs). They read the entire program and convert it into object code, which is a translation of the program source code into a form that the computer can execute directly.
To make life easier, you can go for full-fledged IDEs that can make your experience with C or C++ even more pleasant.
There are a lot of good compilers available on Windows.
On Windows, Visual Studio provides a C++ compiler.
The compiler can also build C programs.
Visual Studio comes with its own powerful, feature-rich IDE, making it a neat choice for anyone getting started with C or C++ or someone primarily targeting the Windows platform.
If you are looking for something more standard compliant, GCC (MinGW) might be what you need. The Codeblocks IDE works exceptionally well in this setup.
Clang, too, is now a formidable choice on Windows—it’s even used to build Google Chrome nowadays.
Other cross-platform IDEs exist, such as Eclipse CDT, Jetbrains CLion, and Netbeans, that provide fully functional C and C++ development environments. Lately, however, these are being eclipsed (pardon the irony) by Visual Studio Code, which is also available for Linux and Mac environments.
If you are on Linux, you probably have GCC installed as a part of your distribution already. If not, installing it should be just a matter of a single command:
# Ubuntusudo apt-get install build-essential# Fedorasudo yum install gcc gcc-c++# Arch Linuxsudo pacman -S base-develThe Codeblocks IDE and Eclipse CDT work equally well on Linux as they do on Windows.
On a Mac you can use Clang or GCC—both are available for free. While GCC has support for a wider range of C and C++ standards, Clang will work fine for most cases.
Clang should already be installed.
You can install GCC using Homebrew:
brew install gccYou can use XCode, a great IDE that is a part of the Mac OS developer tools.
Tutorials are a great way to get started with a new programming language. Even if you are not very familiar with programming itself. The following tutorials will teach you the most important concepts.
This comprehensive C programming online course is great for beginners, who do not necessarily have previous programming experience. It starts from the very basics of C and programming in general and covers advanced topics, such as dynamic memory allocation, file management, etc.
If you are already familiar with C and want to dip your toes in C++, then this two-part course is perfect for you. This course truly highlights the differences between these two languages and shows you how to make the most out of C++.
On the other hand, if you want to start from the basics of C++ and learn it from ground-up, PluralSight has just the tutorial for you. It’s aimed at those who want to be more efficient with C++.
This C programming online course is beginner-friendly and perfect for anyone who wants to get started with C on any of the three popular platforms (Windows, Linux, and Mac OS X).
This course is aimed for anyone who has basic computer knowledge but now wants to get into the realm of programming. Arguably, it’s the best way to learn C++ as your first language. Also, if you find game development interesting, this is the course you want to start with.
Once you are content with your basic C++ programming skills and ready to move on to the real deal, you’ll want an advanced tutorial, like this one. The tutorial covers polymorphism, templates, exception handling, streams, containers, algorithms, stacks, and much more.
Sometimes all you need is a rich list of questions and answers that you can quickly look up to get your problems addressed. This isn’t a tutorial per se, but rather a structured set of frequently asked questions.
This web-based tutorial is intended for advanced C programmers (or Perl or Java programmers—anything considered to have a “C-like grammar”) who want to transition to C++. It continues where the C programming language ends—such as at pointers, memory allocation, and compound types—which makes it a very good C++ programming guide.
As you write more elaborate programs while you learn C++ programming, you may quickly run into maintainability issues. This is where style guides from veteran C++ programmers come in handy. This style guide is maintained by Google.
If the above C/C++ tutorials aren’t enough for you, there are good community-moderated lists of tutorials for learning C and for learning C++.
Books are a great way learn in-depth about a programming language. With a lot of great explanation of how intricate functionalities of a programming language work, knowledge from a good book on C or C++ can give you the upper edge while using these languages for your projects.
While this book does include a small introduction to the C programming language, it’s better suited as a second book if you want to learn to code C. This book provides tips, techniques, examples, and practical advice that will allow advanced developers to maximize their capabilities.
The book is divided into three parts.
The first describes the C language in the strict sense of the term; the second describes the standard library, and the third describes the process of compiling and testing programs with the tools in the popular GNU software collection.
C in a Nutshell is the perfect companion to The C Programming Language by Brian W. Kernighan & Dennis Ritchie (also known as K&R) and destined to be the most reached-for reference book on your desk.
This is the second edition of the original Kernighan & Ritchie text.
It’s commonly referred to as the New Testament as it includes the modifications incorporated by the ANSI standard while retaining the nature of the first edition.
The book assumes that the reader has some basic programming knowledge. So if you’re just starting to program, and C is the first language, this might not be the ideal book for you. However, you might find these condensed notes on it worthwhile.
This is one of the best ways to get an introduction to C programming, and a must-have—especially if you’re starting your own collection of programming books.
Bjarne Stroustrup is the designer of C++ and has written many great books on the topic.
This book is divided into three parts.
The first part provides a tutorial introduction to C++ programming.
The second part presents a discussion of design and software development issues arising in connection with the use of C++, and the third part is a complete reference manual.
With the popularity of C++, several independent distributors of C++ have come forward, but the book discusses ‘pure C++;’ that is, no implementation-dependent extensions are used.
One of the best ways to learn a programming language is by writing small programs relevant to the item you study. There are exercises at the end of each chapter to apply your newly learned knowledge.
Building large software with C++ takes design and discipline. If you are serious about C++, this book is a must-read.
It’s an expert’s guide for design of effective classes, functions, templates, and inheritance hierarchies. The book also discusses how C++ is different from other languages and how to do things “the C++ way”.
The C++ Primer is a great book and will make learning C++ fun. It really is one of the best C++ books out there, but it assumes a lot of familiarity with programming concepts and a proficiency in C.
The latest edition of this book is excellent for programmers who want to get the most out of new and advanced features.
This is a phenomenal book that contains answers to around 500 questions on programming, design, analysis, and testing. It’s not for beginners, but for programmers who have figured out the syntax of the language want to implement them.
If you have questions like “What is a class invariant?”, “How should I use exceptions?”, “What happens when a destructor is executed?”, then this is the book for you.
Xem thêm: Tranh Tô Màu Quần Áo Trẻ Em
If you’re already experienced with C++, but want to test drive the more recent standards of it, read this book. You will be surprised how much C++ has evolved through these new standards. The book discusses how to make the most effective use of the newer capabilities in C++. (Even though the C++ standard is now up to C++17, C++14 is still cutting-edge in many of project contexts.)
One of the most amazing aspects of C++ is its Standard Template Library (STL). It’s one of the most powerful features, but it can be quite complex. This book provides 50 awesome tips and 100+ STL algorithms that explore different areas of the STL, making it more approachable for developers just getting started with C++.