Ask HN: Should I learn C or C++?

1 points by init-as ↗ HN
I am going to college in the US in September as an international student but my school year finished in January. I have about 8 more months of doing nothing on my hands and had thought about learning C or C++ just because I have always heard that they give you a good base knowledge of how other languages work under the hood. I would say I'm fluent in Java, Swift and Python.

Do you have any recommendations for which one I should tackle (or neither)? If you had a good resource to help me learn as someone who isn't a beginner, that would also be great too. Thanks.

12 comments

[ 5.3 ms ] story [ 41.1 ms ] thread
Learn both. C will make you a better programmer, and C++ will set you up for success in the world.
Fair, which one would you recommend picking up first?
Nearly everything you learn with C can be applied to C++ (though some may be frowned upon in modern code bases.) So I recommend learning C...
C first. C++ was originally a superset of C, though my understanding is that that is no longer strictly the case.

Still, learning C will make it easier to learn C++, because C is far simpler and in order to understand C++ you’ll have to master C’s concepts anyway.

C++ still the superset of a language that is a dialect of C. In terms of ISO, it's probably still closest to the C90 dialect, with some C99-like features (inline functions, // comments).
I would agree -- C first. C is foundational knowledge imo.
What do you mean when you say C++ would set them up for success?
Lots of jobs for C++ programmers. It's still industry standard in many industries.
It sounds like you’re way ahead of most of your peers when it comes to technical skills. Why not spend the time developing/practicing social skills or on another hobby altogether?

People burn out on coding faster than they think, and you have a lifetime to do it in your career. You’ll probably never get 8 months of free time again, though.

I suggest looking into the curriculum of your upcoming studies and getting a headstart with whatever language(s) you'll be studying.

The simple truth is that unless you truly specialize, your software developer career is going to be a long string of learning things to solve a problem.

Look up the language you'll be studying, pick one that sounds neat, and grab the nearest tutorial that includes the words "For beginners" in the title.

I'd say start with C because it is closer to the hardware and it's simpler to learn than C++. You will find it easier to pick up C++ later if that is required.

If you know a few other languages it shouldn't take 8 months to become at least proficient at C, so you might then try another language that really stretches your brain. Something like Haskell or even a Lisp. After a language that gets closer to the hardware like C try something very abstract and high level. That's why I mention Lisp above. Reading SICP [0] made me realise just how much of a logical system you can synthesize from almost nothing.

[0] Structure and Interpretation of Computer Programs https://en.wikipedia.org/wiki/Structure_and_Interpretation_o...

If you don't know C, you can hardly write a C++ main function that processes the arguments. Or use C libraries effectively (without someone who does know the C-like subset of C++ having written a class framework for you which wraps them).