Difference between C and C++
The main difference between C and C++ are provided in the table below:
| C | C++ |
|---|---|
| C is a procedure-oriented programming language. | C++ is an object-oriented programming language. |
| C does not support data hiding. | Data is hidden by encapsulation to ensure that data structures and operators are used as intended. |
| C is a subset of C++ | C++ is a superset of C. |
| Function and operator overloading are not supported in C | Function and operator overloading is supported in C++ |
| Namespace features are not present in C | Namespace is used by C++, which avoids name collisions. |
| Functions can not be defined inside structures. | Functions can be defined inside structures. |
| calloc() and malloc() functions are used for memory allocation and free() function is used for memory deallocation. | new operator is used for memory allocation and deletes operator is used for memory deallocation. |
Comments