Is there a major difference between C and C++?
Printable View
Is there a major difference between C and C++?
C older and more DOS oriented. C++ is the improved version of C. It has more features such as classes, object orientation, memory allocation and IO.
There are a lot more, but I cannot think of them at the moment.
C++ was a new version of C written by Bjarne Stroustrup, in order to make C object oriented. That's the major difference - where C uses structs (that's types in VB), C++ uses classes.
As far as I know C had memory allocation too, in the form of the malloc() function, but I'm no expert on it (yet ;))
C++ is a bit easier in some ways, for instance instead of the printf() and scanf() functions you use cin and cout, which basically make it a lot simpler and legible.
Fundamentally they are the same - variables and operators are used in the same ways - but C uses types where C++ uses classes. If you are learning one you're more or less learning them both, except only C++ has classes and objects.
Oh and another thing - it's more strongly typed than C was. For instance you can't have variant pointers (pointers to void in C) in C++. It sounds like a limitation but it's a good thing because you can trap all your type errors at compile time ,instead of runtime.