Piano Guidance
Photo by Arina Krasnikova Pexels Logo Photo: Arina Krasnikova

Is C++ easy if I know C?

C++'s syntax itself isn't hard to learn, especially if you already know C. However, the versatility that makes C++ such a powerful and interesting language is itself the reason why many people find it hard.

When P is silent?
When P is silent?

A silent “p” can be found at the beginning of words, in the middle, or towards the end. Examples of words with a silent “p” include p sychology,...

Read More »
Do you have to pay to propose at Disney World?
Do you have to pay to propose at Disney World?

Enchanting extras begin at $99 and feature everything from a special meal to a unique gift that will make your proposal exactly as you have...

Read More »

From browsers to gaming and robotics, C++ is the programmer’s go-to language. But if you’re curious about learning the language, you’ve likely already heard that C++ is hard to learn. In this article, we’ll provide our thoughts on how long it really takes to learn C++, and why you’ll benefit from giving it a try.

What Is C++?

C++ descended from the C language, an iconic low-level programming language that has found many different uses. For example, both the Linux kernel and the entire Python language were written in C. The term “low-level” refers to a language’s relative proximity to the computer’s hardware. The more a language abstracts away from assembly code, the more high-level it’s considered. Bjarne Stroustrup began working on C++ back in 1979. Then called “C with Classes,” it aimed to combine C’s low-level features with a high-level object-oriented paradigm. The successor of “C with Classes” was named C++, referencing the incremental operator found in both languages (++ means “add one to the value at hand”). Since then, C++ has evolved into a key language for applications that rely on superfast processing power, such as video games, autonomous driving and the Internet of Things (IoT). The TIOBE index ranked it as the fourth most popular programming language in 2020. C++ is a compiled language. This means that upon writing the program and storing it in a script, we call a compiler that converts the entire program into machine-readable code. Compared to interpreted languages like JavaScript and Python, compiled languages execute much faster.

Is C++ Hard To Learn?

So how hard is it to learn C++, really? Of course, there’s not a universal answer. How long it would take you would depend on many factors, such as your background and motivation, and what you want to do with the language. In other words, we can approach learning to program in the same way as we would go about learning to speak a new language. That being said, it’s true that many people personally find C++ to be harder than other languages. In some cases this is simply due to the programming paradigm: High-level languages such as Python and Java are “easier” by definition, as they hide much of the complexity from the user. On the flipside, this makes them less flexible than low-level languages. Coding in a high-level language is a bit like living in a house with many domestic workers. You might have a nanny, a cleaning person and a gardener. Consequently, you think less about everyday problems and can dedicate all your time to your job and hobbies. It’s only when things stop working that you realize how much you rely on your employees. With a low-level language, you do your own cleaning, gardening and child-rearing. While C++ does have low-level features akin to C, it also supports object-oriented programming, and thus adheres to the high-level paradigm. Fittingly, C++ is sometimes referred to as a mid-level language. Its hybrid nature accounts both for C++’s strengths, as well as its challenges.

How many times can you hot swap?
How many times can you hot swap?

Hot swap switches all have a maximum number of swaps before they wear out, good sockets can switch out 100 times before any noticeable degredation....

Read More »
What is Lady Gaga's vocal range?
What is Lady Gaga's vocal range?

Lady Gaga's can sing approximately three octaves, spanning A2 – G5 – B5. What is Lady Gaga's vocal fach or voice type? Lady Gaga is a Lyric Mezzo-...

Read More »

There’s a rumor floating around the internet that Bjarne himself rates his own C++ proficiency a seven out of 10. Whether that’s true or not, it shows the extent to which C++ programmers themselves struggle with the language’s complexity. Take a look at Bjarne’s FAQ where he answers questions such as “How long does it take to learn C++?” and “What’s so great about classes?” C++’s syntax itself isn’t hard to learn, especially if you already know C. However, the versatility that makes C++ such a powerful and interesting language is itself the reason why many people find it hard. Let’s look at some sources of confusion that may arise when you begin to learn C++.

Memory Management

Whenever you create a new data structure (e.g., an integer, string or array), it has to be physically allocated to an address in memory. In high-level languages, this is something we rarely think about — the memory manager does it all for us! But in C++, we have to think about our hardware resources and how to most efficiently use them. So after creating a variable and assigning it a place in memory, we have to actively de-assign that space when we stop using the variable. You can probably think of many ways in which this can go wrong. For instance, if we want to use a variable that has been deallocated, the object would no longer exist. There’s also the reverse case of a variable continuing to occupy space although it’s no longer needed by the program. This is referred to as a memory leak. When a program with a memory leak continues to run for a while, amassing more and more unneeded variables, this can result in a crash.

Pointers

This topic seems to be a source of confusion for many C++ newbies. Pointers are simply variables that contain the addresses of other variables. Their big advantage is that you can operate with a pointer (your variable’s address) without invoking the variable itself. This makes for faster, more efficient code. And since C++ is all about efficiency, pointers are used quite a lot in C++ programs. Handling pointers in the wrong way can again lead to memory issues — imagine knowing the pointer but forgetting the variable, or the other way round.

Classes

As C++’s former name clearly stresses, the whole point of this new language was to have “C with classes.” If you come from another object-oriented language, you’ll have no problem understanding the concept. Classes are blueprints for complex data types known as objects. They come with all kinds of attributes and functions. Whenever you instantiate a class, you create a new object that comes ready with all the functionality. Classes make for great, modular code.

What is the golden rule of guitar?
What is the golden rule of guitar?

So, I want to explain the guitar player's golden rule: never play the same part as the other guitarist. It doesn't matter if you can only play...

Read More »
Which Casio keyboard is best for kids?
Which Casio keyboard is best for kids?

Casio SA76 - Best Mini-Key Keyboard The Casio SA76 is a great choice for younger kids just beginning to show an interest in the piano. If your...

Read More »

Compiling

We’ve already mentioned the compiler. A compiler is like a translator that converts an entire script to a language that the computer understands (ones and zeros, essentially). There are many different compilers and you’ll have to choose yours according to your operating system. If you decide to write C++ code in an interactive development environment (IDE) such as Visual Studio or Eclipse, it will already include a C++ compiler.

Typing

If you’re coming from a dynamically typed language like Python, you might not be familiar with this concept. Languages like C and C++ are strongly typed, meaning that when you create a new variable, you declare its type — whether a vector, a floating-point number or a character — and it cannot be anything else. Python, in comparison, uses duck-typing, by which types are declared implicitly and can be changed any time. Strongly typed code has the great advantage of being somewhat self-documenting. Whereas in Python you often need to write a docstring detailing what types of arguments your function accepts and what it returns, in C++ all this information is conveyed in the function itself.

Why You Should Learn C++

As general advice, learning a new programming language — especially one that operates with paradigms that are new to you — is never a bad idea. That’s because good programming is not really about knowing a particular language inside out. Rather, it’s knowing how to write clean, documented code to achieve what you want. This skill is better honed by learning more about programming in general rather than by mastering every aspect of a given language. But if you’re looking to get into one of the areas we’ve mentioned (i.e., gaming, self-driving cars, IoT or even banking), developing a solid base in C++ will pay dividends So how long does it take to learn C++? That depends on the student, of course. You might find frustration along your C++ learning journey as you start grappling with topics like memory management and classes. Consider a structured learning approach to stay motivated and speed the process along.

To get started, check out our C++ Nanodegree.

Start Learning

What is a good price for a grand piano?
What is a good price for a grand piano?

How Much Does A Grand Piano Cost? A brand new grand piano would cost you around $10,000 to $200,000. The producer, the retailer, the type, and the...

Read More »
How do you tell if a key is a transponder key?
How do you tell if a key is a transponder key?

Transponder Key vs Non-Transponder Key The difference between the two keys is that one has a micro-chip inside it and the other doesn't. The chip...

Read More »
How many keys can a guitar play?
How many keys can a guitar play?

12 In Western music, there are 12 different notes you can play. Each note is a half step (also called a half tone or semitone) higher than the...

Read More »
Can you practice too much?
Can you practice too much?

However, doing so can have some serious consequences. Results of too much practice can manifest in depression, burn out, and physical injury. In...

Read More »