When to use C over C++, and C++ over C?

Posted by Dark Templar on Programmers See other posts from Programmers or by Dark Templar
Published on 2011-10-09T18:07:58Z Indexed on 2011/11/30 2:06 UTC
Read the original article Hit count: 217

Filed under:
|

I've been introduced to Computer Science for a little over a year now, and from my experience it seems that C and C++ are both considered one of the "ultrafast" languages out there, whereas others such as Python and such scripting languages are usually deemed somewhat slower.

But I've also seen many cases where a software project or even a small one would interleave files where a certain number n of those files would be written in C, and a certain number m of those files would be written in C++.

(I also noticed that C++ files almost always have corresponding headers, while C files not so much). But my main point of inquiry is to get a general sense of intuition on when it is appropriate to use C over C++, and when it is better to use C++ over C. Other than the facts that (1) C++ is object-oriented whereas C is not, and (2) the syntaxes are very similar, and C++ was intentionally created to resemble C in many ways, I am not sure what their differences are. It seems to me that they are (almost) perfectly interchangeable in many domains.

So it would be appreciated if someone could clear up the situation! Thanks

© Programmers or respective owner

Related posts about c++

Related posts about c