Difference Between C and C++ language

Difference Between C and C++ language

C and C++

The big difference b/w C and C++ are that C is a procedural language that means it does not support classes, while C++ support both procedural and object-oriented programming like features classes and objects, Inheritance etc. 

 

There are following in detail difference between c and C++ programming language in easy table form.

 

Comparison        

           

C Language C++ Language
History In 1972, C language was designed by Dennis Ritchie at AT&T Bell Labs. In 1979, C++ was designed by Bjarne Stroustrup at AT&T Bell Labs
Subset / Superset C language is a subset of C++. C++ language is a superset of C. C++ can run most of C code while C cannot run C++ code.
Input / Output source code For output printf

For input  scanf

For output cout

For input  cin

Reference Variable C language does not support reference variables. C++ language does supports reference variables.
Namespace feature C language does not support namespace feature C++ language does Support   NAMESPACE which avoids name collisions.
Function Structure C language does not permit functions for defined inside the structures. C++ language, functions can be used inside a structure code.
Data Hiding Support C language does not support hiding information because data are free entities and can be manipulated by outside code. C++ language does support Data Hiding feature for example Encapsulation feature.
Procedural / Object Oriented C language is procedural programming that code into a collection of variables, data structures, and subroutine C++ language supports both procedural and objects oriented programming code into objects that methods and data using interfaces.

Examples:

     -Objects and Classes
-Polymorphism
-Encapsulation
-Inheritance

Driven Language Type C language is a function-driven language. C++ language is an object driven language.