C++ can be said a superset of C. Major added features in C++ are Object-Oriented Programming, Exception Handling and rich C++ Library.
- C:
C was developed by Dennis Ritchie between the year 1969 and 1973 at AT&T Bell Labs.
C does no support polymorphism, encapsulation, and inheritance which means that C does not support object oriented programming.
C is a subset of C++.
C contains 32 keywords.
For the development of code, C supports procedural programming.
Data and functions are separated in C because it is a procedural programming language.
C does not support information hiding. Data is hidden by the Encapsulation to ensure that data structures and operators are used as intended.
Built-in data types is supported in C.
C is a function driven language because C is a procedural programming language.
Function and operator overloading is not supported in C.
C is a function-driven language.
Functions in C are not defined inside structures.
Namespace features are not present inside the C.
Header file used by C is stdio.h.
Reference variables are not supported by C.
Virtual and friend functions are not supported by C.
C does not support inheritance.
Instead of focusing on data, C focuses on method or process.
C provides malloc() and calloc() functions for dynamic memory allocation, and free() for memory de-allocation.
Direct support for exception handling is not supported by C.
scanf() and printf() functions are used for input/output in C.
- C++:
C++ was developed by Bjarne Stroustrup in 1979.
C++ supports polymorphism, encapsulation, and inheritance because it is an object oriented programming language.
C++ is a superset of C.
C++ contains 52 keywords.
C++ is known as hybrid language because C++ supports both procedural and object oriented programming paradigms.
Data and functions are encapsulated together in form of an object in C++.
Built-in & user-defined data types is supported in C++.
C++ is an object driven language because it is an object oriented programming.
C++ is an object-driven language.
Functions can be used inside a structure in C++.
Namespace is used by C++, which avoid name collisions.
Header file used by C++ is iostream.h.
Reference variables are supported by C++.
C++ supports inheritance
Virtual and friend functions are supported by C++.
C++ focuses on data instead of focusing on method or procedure.
C++ provides new operator for memory allocation and delete operator for memory de-allocation.
Exception handling is supported by C++.
cin and cout are used for input/output in C++.