The major difference between C and C++ is that, C is a procedural language whereas C++ is an extension of C which also supports object oriented programming paradigm. Following table highlights the major differences between C and C++ programming languages.
Difference Between C and C++
C | C++ |
---|---|
C is Procedural Language. | C++ is a combination of both procedural and object oriented programming language. |
C was originally developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs in USA. | C++ was developed by Bjarne Stroustrup in 1979 at Bell Labs in New Jersey, USA. |
C being a procedural programming language, it is a function driven language. | C++ being an object oriented programming language, it is an object driven language. |
B was the precursor language of C. | C was the precursor language of C++. |
C is a subset of C++. | C++ is superset of C, with extension of object oriented programming features like class, objects, inheritance etc. |
C does not support object oriented programming features like encapsulation, inheritance, polymorphism etc. | C++ being an object oriented language supports encapsulation, inheritance, polymorphism. |
In C, data and functions are separate and free entities. Data and functions are not encapsulated inside a single entity. | In C++, we can encapsulated data and functions together in form of an object. Classes are like schema to bind data and functions together. |
In C, data can be accessed from anywhere. C does does not support features for data hiding and access restriction. | In C++, encapsulation of data inside a class hides it from rest of the world. We give give permission to only few function to access data using access modifiers like private, public and protected. |
C only support pointers and does not support reference variables. | C++ supports both pointers and reference variables. |
C has no support for virtual and friend functions. | C++ supports virtual and friend functions. |
In C, Exception Handling is not present. | In C++, Exception Handling is done with Try and Catch block. |
C does not support overloading of function and operator. | C++ support overloading of function and operator. |