This question is often asked and if you have any programming friends, you’ll likely get a different answer from each friend. And you may even get a another suggestion to learn Java instead.

So which should I learn?

Eventually, you’ll find value in learning multiple languages. And there could be a new language that you’re interested in five years from now. If there’s one certainty in technology, it’s that things change.

I started out learning plain old C and then learned C++ and then C#. Both C++ and C# have roots in C but there’s a huge shift in the way a C program is written with procedures vs. the object-oriented patterns of C++ and C#. It comes down to how you approach problems and the way you think about the solutions. Learning C first will make it easy and almost natural to continue solving problems in the C style that you’re familiar with and will make it harder to understand solutions that are more object-oriented.

I don’t recommend learning C first. There’re just too many habits you’ll struggle with later when moving to either C++ or C#. So let’s change the question slightly to which to lean first – C++ or C#? I do recommend that you eventually learn all three languages. Just don’t start with C.

Is one language better than the other?

You may hear that the answer depends on what types of programs you want to write and that C++ is better for backend or server type applications and services while C# is better for Windows applications used directly. I don’t think so. I’ve seen some really good games and applications written in C++ and I’ve seen some major infrastructure and engine software written in C#. There has to be more to it than that.

Both C++ and C# have gone through major changes over the years and both have kept up very well with modern programming standards. It may be that at this moment C++ has some feature missing from C# or the other way around but that’s temporary. If a new concept proves to be really useful to programmers, then it’s probably going to find its way into other languages. This means that both C++ and C# are tied in the long run and you can’t really base your decision on the current features of either language.

Once you understand the features and current capabilities of a language, you’ll find that the real work of learning a new language is actually learning the libraries that accompany the language. This takes time for any language and I would have to give the advantage to C# here just because of the huge advances that Microsoft has made with making the .Net Framework library a consistent experience.

However, going back to the earlier point about learning multiple languages, let’s assume that you’ll eventually learn all three: C, C++, and C#. Since you’re going to have to learn the libraries of each language, it seems that the question of which is best then comes down to which language will be the most help to you when you start learning the others.

Which language will help me the most when I want to learn the others?

In other words, will you be a better programmer and find it easier to learn C++ and then C#? Or should you learn C# and apply what you learned to C++?

Just like the way you learn to go about solving problems with C causes trouble with both C++ and C#, there are aspects of C# that, while they work perfect for C#, will cause problems for you later when you begin learning C++. The C# language tries to protect you from many common mistakes that C++ programmers make. This is great if you’re coming to C# after learning C++. But will cause you some real frustration if you try to go the other way. I also think that learning C++ first will give you a better appreciation for C# and will make you a better programmer overall.

While learning C# first might be faster because of the more consistent library, you’ll stumble more when learning C++ and will be more likely to give up and stick with just C#. On the other hand, learning C++ first might seem harder, but you’re building a much better foundation and will be much more likely to end up mastering all three languages.

Is C++ more complicated than C#?

A lot of people think so and the biggest reason that I have heard is that C# provides garbage collection so you no longer have to worry about memory leaks. That’s just one of those C# aspects that I mentioned that’s preventing a lot of people from understanding how things really work. Let’s get one thing straight; if you don’t understand memory management and think that the language will just take care of it for you, then you will not be able to program well in any language. You can still have memory leaks in C#. You can write your C++ programs using smart pointers that go a long way towards solving the memory management issues that so many people accuse C++ of not handling well.

There are also capabilities in C++ such as multiple inheritance that many people cite as another reason that C++ is harder than C#. It’s true that this feature requires more thought to get right and should not be used for every occasion. If done wrong, multiple inheritance can make a program harder to understand and may cause it to have more bugs. But is the answer to remove the capability from the language like C# did or to learn to use the capability wisely?

The C++ language tends to give you more choices. When learning the language, if you find multiple inheritance too difficult, then don’t use it right away until you better understand it. Once you do understand multiple inheritance, then you’ll fully appreciate what C# provides.

The C++ language also provides a feature called templates that at first seems similar to something called generics in C#. However, C# generics is missing half the functionality of C++ templates. If you start out only learning C# generics, then you’re likely to never make use of the full power of C++ templates just because it’s not what you first learned and you may not even notice that there is more available. However, learning C++ templates first will better prepare you for the differences in C# generics.

Overall, I’d say that C++ is harder to learn than C# because of the extra capabilities included in C++ and because the library is not as consistent as C#. The C++ library is getting better so this is another of those temporary feature comparisons that I mentioned that could change over time.

Should I start with C++ or with C#?

If you’re only going to learn either C++ or C#, then you should probably go with C# because it’s easier and faster to learn and widely applicable. There’s nothing wrong with only learning C# and you can write any type of software with the language. But if you think that you might someday need both languages, then learning C++ first will better prepare you and make your overall learning easier and at the same time give you an even wider skill set to work with.

And there’s an added benefit to learning C++ first; not only will you be more likely to learn both C and C# but you’ll be a better programmer because of your more solid foundation. There are some aspects to C# that will be taken for granted by people who only know C#. But if you know C++, then you’ll have insights into C# that will set you apart from others who know only C#.

Listen to this podcast episode about how C++ is used to program video games.

The C++ language is used for many types of projects requiring speed, scale, and responsiveness. It’s also a great choice for video games. Why? The C++ language is more towards the low level of language abstraction but not all the way.

Support Take Up Code on Patreon for additional benefits.