Tuesday, 12 March 2019

What is difference between C and C++? tccicomputercoaching.com

C and C++ both are programming Languages.

But the major difference between C and C++ is that C is a procedural programming language and does not support classes and objects, while C++ is a object oriented programming language ;

C is a subset of C++. While C++ is a superset of C.


Approach:

Top down approach is used in Program Design.
Bottom up approach adopted in Program Design.

Input / Output Function:

In C
  • scanf() Function used for Input.
  • printf() Function used for output.
In C++
  • Cin>> Function used for Input.
  • Cout<< Function used for output.

Virtual Function:

C has no support for virtual and friend functions. The concepts of virtual Functions are used in C++.

Polymorphism:

In C, Polymorphism is not possible.
The concept of polymorphism is used in C++. Polymorphism is the most Important Feature of OOPS.

Operator overloading:

Operator overloading is not possible in C.
Operator overloading is one of the greatest Feature of C++.

Namespace:

No namespace Feature is present in C Language.
Namespace Feature is present in C++ for avoiding Name collision.

Variable Declaration:

Multiple Declarations of global variables are allowed.
Multiple Declarations of global variables are not allowed.

Encapsulation:

Data and functions are separate and free entities.
Data and functions are encapsulated together in form of an object.

Reference variables:

C does not support reference variables. C++ supports reference variables.

Dynamic Memory Allocation:

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.

To learn more about C Language, C++ Language, Other Programming Languages

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/computer-course/

No comments:

Post a Comment