Should I learn C before C++? Isn't C better because it has less overhead?

Submitted on: 1/1/2015 8:57:00 AM
By: Blake Madden (from psc cd)  
Level: Beginner
User Rating: By 12 Users
Compatibility: C++ (general)
Views: 821
     Offers advice on whether you must know C before C++ and whether C is preferable over C++ because of overhead.

				Should I learn C before C++? Isn't C better because it has less overhead?
These are very valid questions and ones that I believe should be answered prior to delving into the world of C/C++. I feel that the answers are "no, you should learn C++ first, then you should come to understand the fundamental differences C++ and its predocessor" and "no, C++ still retains the efficiency of C with improved and new features." Many people are apt to veiw C and C++ as two entirely different languages, whereas I prefer to see C++ as an improved version of C that can still utilize many of the features that are thought of as "C-style." Some C programmers will argue that C++ is too large with too much overhead. The fact is that there is indeed more overhead with classes as opposed to (C-style, data-only) structures. However, you should bear in mind that just because you are using C++ you don't need to make everything object-oriented. This is to say, if you feel the situation calls for a simple structure or enumeration, then by all means use them. There's nothing wrong with utilizing the less complex and more efficient C-style data types when data encapsulation isn't a major concern, but memory is. The point is, C++ is a better C with improved (completely overhauled , actually) data structures, memory allocation, and I/O features. You are much better off learning and using this improved methods first, and then go back and familiarize yourself with the way C handles these methods. C++ is a big, complex language, but I honestly don't feel that coming to learn C first will necessarily aid you. Learning C's (error-prone) I/O system and memory allocation instead of C++'s will only cause bad practice and style further down the road. However, you should at least understand C's methods in case you ever work with legacy code. You also can familiarize yourself with the data structure efficieny in C, so that you can incorproate that along with object-oriented data structures. I have to agree with some C++ critics that it can have a bit of overhead in some cases, but C++'s advanced features--like overloaded operators and multiple inheritance--are options, not requirements. This is the whole reason why C was chosen to be the base language, because of its efficiency, and C++ still has all of that efficieny with improved and more features. 

Other 2 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.