Should I learn C before learning C++?

c++ c
Ross picture Ross · Feb 28, 2009 · Viewed 159.9k times · Source

I visited a university CS department open day today and in the labs tour we sat down to play with a couple of final-year projects from undergraduate students. One was particularly good - a sort of FPS asteroids game. I decided to take a peek in the src directory to find it was done in C++ (most of the other projects were Java 3D apps).

I haven't done any C before but I have looked through some C code before. From what I saw in the .cpp code in this game it didn't look very different.

I'm interested in learning either C or C++ but will probably learn the other later on. Is there any advantage to me learning one before the other and if so, which one?

Answer

Brian R. Bondy picture Brian R. Bondy · Feb 28, 2009

There is no need to learn C before learning C++.

They are different languages. It is a common misconception that C++ is in some way dependent on C and not a fully specified language on its own.

Just because C++ shares a lot of the same syntax and a lot of the same semantics, does not mean you need to learn C first.

If you learn C++ you will eventually learn most of C with some differences between the languages that you will learn over time. In fact its a very hard thing to write proper C++ because intermediate C++ programmers tend to write C/C++.That is true whether or not you started with C or started with C++.

If you know C first, then that is good plus to learning C++. You will start with knowing a chunk of the language. If you do not know C first then there is no point focusing on a different language. There are plenty of good books and tutorials available that start you from knowing nothing and will cover anything you would learn from C which applies to C++ as well.

Please see further reasoning in this answer.