I'm thinking about learning to program in c/c++. Which one should I learn?
Thanks.
Printable View
I'm thinking about learning to program in c/c++. Which one should I learn?
Thanks.
That may have involved a lot of factors and matters in return for a judgement, mainly acted upon the platform you majorly target in.
(1). DOS ----> C
(2). Win32--> C++
(I recommend Visual C++ instead of Borland C++ for Win32)
Hope that will help with a little piece of advice. Wish you a Merry Christmas and a Happy New Year.
And why shouldn't you program for C++ in DOS?
Actually...I can't see why anyone would write for DOS, but that might be just me...
Anyway, definitely learn C++. The language has matured considerably from its early days and I don't think there's any performance penalty to using the object-oriented features of the language, if you use them properly (i.e. use templates and inline functions, and const in the necessary places).
C++ code, when well written, is a lot easier to read than the equivalent C, and is easier to support because it's more resilient because C++ has a different error handling strategy.
Sorry for the essay, just got back from the pub and my fingers got carried away :)
Well not exactly a different error handling strategy. It has the same ones as C, with the added extra of exceptions. Exceptions are great for some things but you wouldn't (or at least probably shouldn't) use them exclusively for error handling.
To answer the original question though, learn C++. Along the way you'll probably end up learning C anyway, which is no bad thing.
There are many people who would suggest that you learn C before C++ but I don't see any point to that. As a better approach, I would suggest learning C++ first, then after you know it pretty well, take a look C.
I read this somewhere... (just so you know what you need time-wise)
Quote:
if you want to be fully comfortable with all the major C++ language constructs, with data abstraction, Object-Oriented programming, generic programming, Object-Oriented design, etc., you can easily spend a year or two - if you aren't already acquainted with those techniques.
-Emo