Blog

The Ultimate List of Resources to Learn C and C++

C is often called a middle-level computer language as it combines the elements of high-level languages with the functionalism of assembly language. C allows the manipulation of bits, bytes, and addresses – giving the programmer more control over exactly how the program will behave and a 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 is 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.

C++ is actually an extensible language 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.

How can I get started with C and C++?

To get started with C or C++, what you need, at the very least, is a compiler.

Compiler programs can be run through command line interfaces. 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.

 

Windows

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.

Linux

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 line of command:

# Ubuntu
sudo apt-get install build-essential

# Fedora
sudo yum install gcc gcc-c++

# Arch Linux
sudo pacman -S base-devel

Codeblocks IDE and Eclipse CDT works equally well on Linux as they do on Windows.

Mac OS X / macOS

On Mac OS X 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 gcc

You can use XCode, a great IDE that is a part of the Mac OS developer tools.

 

Can I learn C and C++ by reading books?

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.

 

The C++ Programming Language (Special Third Edition) by Bjarne Stroustrup

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++.

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.