July 18th, 2013, 02:48 PM
Difference between c and c++
There are articles that explain the technical differences between the two languages, but that's not what I want to know.
Often, when I look for an answer to a question for C, I come across articles on the same topic for C++.
I want to know if it's safe to read these articles for C++, and assume that the explanation holds for C as well.
July 18th, 2013, 03:39 PM
For the most part, yes.
There are a few ways to look at C++, but basically C++ is a super-set of C, meaning that it is largely just C with other capabilities added on. With very few exceptions, you should be able to take just about any C program and compile it as C++.
What you would have to look out for would be if that C++ example uses a feature that C does not have. Such as function overloading (having multiple functions with the exact same name, but different numbers and types of parameters), being able to declare variables in the midst of code (though this was added in C99), or of course using new and delete for dynamic allocation or iostreams. So understand that the C++ example might not compile successfully as C.
July 18th, 2013, 05:39 PM