Google News
logo
CPP - Interview Questions
What is the difference between C and C++?
The main difference between C and C++ are provided in the table below :

C C++
* C language was developed by Dennis Ritchie. * C++ language was developed by Bjarne Stroustrup.
* C is a structured programming language. * C++ supports both structural and object-oriented programming language.
* C is a subset of C++. * C++ is a superset of C.
* In C language, data and functions are the free entities. * In the C++ language, both data and functions are encapsulated together in the form of a project.
* C does not support the data hiding. Therefore, the data can be used by the outside world. * C++ supports data hiding. Therefore, the data cannot be accessed by the outside world.
* 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.
* In C, scanf() and printf() are mainly used for input/output. * C++ mainly uses stream cin and cout to perform input and output operations.
Advertisement