Difference between C & C++ | C Language Vs. C++ Language
C Language Vs. C++ Language
C Language |
C++ Language |
|
Language |
‘C’ is a procedure Oriented language. | ‘C++’ is an object oriented language. |
Founder |
‘C’ language is developed by Dennies Ritchie. | ‘C++’ language is developed by Bjarne Stroustrup. |
Approach |
‘C’ language follows top-down approach. | ‘C++’ follows bottom up approach. |
OOPS Concepts |
As ‘C’ language is procedure oriented language, it does not support OOPS concepts such as class, object, Inheritance, Polymorphism, Data hiding,etc. | C++ is an object oriented language hence supports class, object, data hiding, polymorphism, Inheritance, abstraction, etc.. |
Focus |
C focus on method or process rather than data. | C++ focuses on data rather than method or procedure. |
Building Blocks |
Building blocks of ‘C’ language are : functions. | Building blocks of ‘C++’ language are : objects. |
Input-output |
‘C’ language uses scanf() and printf() for input and output. | ‘C++’ language uses cin>> and cout<< operators for input and output. |
Virtual functions & Reference Variable |
‘C’ language does not support virtual functions and reference variables. | ‘C++’ language supports virtual functions & reference variables. |
Exception Handling |
It does not support exception handling | It supports exception handling using try and catch block. |
Declaration of variables |
It require to declare all the variables at the top of the program. | It allows to declare variable anywhere in the program before use. |
Memory functions |
‘C’ language uses calloc(), malloc() and free() functions for allocating and de-allocating memory. | ‘C++’ language uses operators new and delete for the same purpose. |
File Extension |
‘C’ program has file extension .c | ‘C++’ program has file extension .cpp |