Difference Between C & C++

In this section of the C++ Tutorial, let’s have a look at the difference between C & C++. Both C & C++ are widely used programming language, however, the major difference between C and C++ is that C does not support classes whereas C++ support it.

Let’s have a look at the difference between C and C++ based on some classification parameters.

Difference Between C & C++

ParametersCC++
DevelopmentC was developed by Dennis Ritchie between the years 1969 and 1973 at AT&T Bell Labs.C++ was developed by Bjarne Stroustrup in 1979.
Subset/supersetC is a subset of C++.C++ is a superset of C.
ApproachC follows the top-down approach.C++ follows the bottom-up approach.
Data securityData is less secured in C.In C++, you can use modifiers for class members to make it inaccessible for outside users.
FocusInstead of focusing on data, C focuses on method or process.C++ focuses on data instead of focusing on method or procedure.
Programming language typeC is a function-driven language because C is a procedural programming language.C++ is an object driven language because it is object-oriented programming.
FunctionsFunctions in C are not defined inside structures.Functions can be used inside a structure in C++.
Program divisionC programs are divided into procedures and modulesC++ programs are divided into functions and classes.
Data and functionsData and functions are separated in C because it is a procedural programming language.Data and functions are encapsulated together in the form of an object in C++.
Header filesHeader file used by C is stdio.h.Header file used by C++ is iostream.h.
KeywordsC contains 32 keywords.C++ contains 52 keywords.
Input/OutputIn C, scanf() and printf() are mainly used for input/output.C++ mainly uses stream cin and cout to perform input and output operations.
Memory allocation/deallocationC provides malloc() and calloc() functions for dynamic memory allocation, and free() for memory de-allocation.C++ provides new operator for memory allocation and delete operator for memory de-allocation.
Expection HandlingException handling is not easy in C. It has to perform using other functions.C++ provides exception handling using Try and Catch block.
Function OverloadingNot supportedSupported
Functions in structureNot supportedSupported
Reference variables.Not supportedSupported
Operator overloadingNot supportedSupported
NamespaceNot supportedSupported
Polymorphism, Encapsulation, and InheritanceNot supportedSupported
Function and operator overloadingNot supportedSupported
Virtual and friend functionsNot supportedSupported

 

Leave a Comment

Your email address will not be published. Required fields are marked *