Question:
What are the differences between C and C++?
anonymous
1970-01-01 00:00:00 UTC
What are the differences between C and C++?
Seven answers:
braindigitalis
2009-06-10 09:09:12 UTC
C++ is a derivative of C, which contains amongst other things support for classes and object orientation, and templates. For a large project, C++ is usually the way to go these days as it allows for project management to be handled easier by large teams.



C++ is also easier to write more secure and stable code with, once you get used to it, as the libraries that come bundled with it (such as STL and Boost) are designed to prevent buffer overruns and print format vulnerabilities (google these if you need more information, they are outside the scope of this answer).
?
2009-06-10 09:06:58 UTC
C is much older and is a simple procedural language. C++ adds OOP to C and this makes it a lot more complex. They are both "current" but they tend to be used for somewhat different problem domains (with some overlap).
?
2016-05-26 12:19:36 UTC
C++ is arguably the most fully implemented object oriented language to come out. With lots of neat features like being able to define your own operators, define template classes/functions for objects that operate on non-related classes thrown in for good measure. Basically it's a question of application. If you're writing drivers for your new but unsupported on unix graphics card use c. For everything else use c++.
Jabber wock
2009-06-10 09:51:06 UTC
C is older, and is a procedural language.



C++ is newer, a superset of C, and is an object oriented language.
Gabe
2009-06-10 10:26:02 UTC
just learn C++
anonymous
2009-06-10 08:56:03 UTC
On Wii Big Brain Academy about 150g brain weight
Ciaron
2009-06-10 09:11:35 UTC
The C programming language is a very general purpose programming language. It is used to solve problems ranging from operating system kernels, over compilers to graphical user interfaces. C was conceived in the early 1970s by Dennis M. Ritchie. The C programming language was standardized in the mid 1980s.



The C++ programming language was initially created by Bjarne Stroustrup, as a "better C". C++ was an attempt to extend and (to some extent) change the C programming language to overcome some of the common and big problems with the language. C++ was standardized in 1998, and, is a younger language than C.

Numerous features supported by C++ which have no equivalent in C such as object-oriented programming.



When a user defines a type in C++, support is provided in the language to permit that type to behave in a manner similar to types already built into the language. The user can define how the standard operators act upon these user defined types (operator overloading) and how these type can be converted to another type (user defined conversions). The user can also specify how memory is allocated or deallocated when an instance of that type is created or destroyed. This is done through the use of constructors and destructors which are called implicitly by the compiler when an instance of that type is brought into and taken out of scope respectively.



C++ provides support for function prototypes, hence enabling strong type checking of function parameters to take place during compilation. In addition, C++ provides support for the pass by reference mechanism and also supports default arguments to functions. This means that should a function require an argument that often has the same value, the user can default the argument to that value and not pass that parameter when the function is called. In the few cases where the function has to be called with a different value for the default argument, the user simply passes that argument into the function and the new value overrides the default value.



The most important features which C++ has is data encapsulation, inheritance and runtime binding which is the foundation for the language's support for object-orientated programming.



In the case of C against C++

* Speed - the C++ implementation ran as fast or faster than the C implementation

* Generality - the C++ implementation is easily reusable in other projects (unlike the C implementation)

* Usability - the C++ implementation managed its memory properly (unlike the C implementation)

This is particularly useful in safety critical applications.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...