Search This Blog

Friday, August 14, 2020

Differences between C and C++ | Basic difference between c and c++ | codes with abhi

Differences between C and C++ Differences between C and C++ programming language

                  C++ Programming:- 

In this tutorial you will learn:-

 Differences between C and C++:

 

 


       C                     C++

C does no support polymorphism, encapsulation, and inheritance which suggests that C doesn't support object oriented programming

C++ supports polymorphism, encapsulation, and inheritance because it's an object oriented programing language

C may be a subset of C++

C++ may be a superset of C.

C contains 32 keywords

C++ contains 52 keywords.

For the event of code, C supports procedural programming

C++ is understood as hybrid language because C++ supports both procedural and object oriented programming paradigms.

Data and functions are separated in C because it's a procedural programing language

Data and functions are encapsulated together in sort of an object in C++.

C doesn't support information hiding

Data is hidden by the Encapsulation to make sure that data structures and operators are used as intended

C may be a function driven language because C may be a procedural programing language

 

C++ is an object driven language because it's an object oriented programming.

Function and operator overloading isn't supported in C

 

Function and operator overloading  supported in C++

C may be a function-driven language

\

C++ is an object-driven language

Namespace features aren't present inside the C

Namespace is employed by C++, which avoid name collisions.

Header file employed by C is stdio.h

 

Header file employed by C++ is iostream.h.

Reference variables aren't supported by C

 

Reference variables are supported by C++.

Virtual and friend functions aren't supported by C

Virtual and friend functions are supported by C++.

C doesn't support inheritance

C++ supports inheritance.

 C 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.

C was developed by Dennis Ritchie between the year 1969 and 1973 at AT&T Bell Labs 

C++ was developed by Bjarne Stroustrup in 1979.

 

For Example


C-Variable declaration

Only at the top:

int i;

for(i=10; i<10;i++)

 

 

C++ variable declaration

Anywhere in the program;

for(i=1;i<10;i++)

 


Mr. abhijeet dwivedi

Developer

Hey, I'm Abhijeet

0 comments:

Post a Comment

If you have any doubt, please let me know