Difference Between C and C++

C being a a procedural programming language does not support classes and objects which are building blocks of object oriented programming but C++ on the other hand is the combination of procedural and object oriented programming language. Following points will give you point by point differences between C and C++ language.

Difference Between C and C++

CC++

C was developed in 1969 at AT&T Bell Labs by Dennis Ritchie.

C++ was developed in 1979 by Bjarne Stroustrup.

C is a subset of C++ language.

C++ is a superset of C. You can run most of the C code in C++ but reverse is not possible.

Procedural programming is supported in C.

Procedural and Object oriented programming both are supported in C++.

C is a function driven language.

C++ is an object driven language. 

Data and functions are separate and free entities.

Data and functions are encapsulated in the form of an object. Class is a blueprint of the object.

Does not support information hiding.

Encapsulation hides the data which can be used for information hiding.

Multiple Declaration of global variables are allowed.

Multiple Declaration of global varioables are not allowed.

Function and Operator overloading is not supported.

Function and Operator overloading is supported.

Functions can not be defined inside structures.

Functions can be defined inside a structure.

Namespace feature is not provided.

Namespace is allowed to avoid name collisions.

scanf is used for input where printf is used for output.

cin is used for input and cout is used for output.

Reference variables are not supported.

Reference variables are supported.

Virtual and Friend functions are not supported.

Virtual and Friend functions are supported.

malloc() and calloc() functions are used for dynamic memory allocation where as free() function is used for memory de-allocation.

new operator is used for for memory allocation and delete operator  is used for memory de-allocation.

No support for object oriented programming. So there is no support for polymorphism, encapsulation, and inheritance.

C++ language supports polymorphism, encapsulation, and inheritance which are part of object oriented programming.

main() function can be called from other Functions.

We can not call main() function from other functions.

All variables must be defined at the starting of a scope.

You can declare variables anywhere in C++.

Inheritance is not possible.

Inheritance is allowed in C++. 

Exception handling is not supported.

Exception handling is supported in C++. 


Next > < Prev
Scroll to Top