Difference b/w C and C++

Advertisements

C vs C++

CC++
C is Procedural Language.C++ is non Procedural i.e Object oriented Language.
No virtual Functions are present in C.The concept of virtual Functions are used in C++.
In C, Polymorphism is not possible.The concept of polymorphism is used in C++.Polymorphism is the most Important Feature of OOPS.
Operator overloading is not possible in C.Operator overloading is one of the greatest Feature of C++.
Top down approach is used in Program Design.Bottom up approach adopted in Program Design.
No namespace Feature is present in C Language.Namespace Feature is present in C++ for avoiding Name collision.
Multiple Declaration of global variables are allowed.Multiple Declaration of global variables are not allowed.
In C
  • scanf() Function used for Input.
  • printf() Function used for output.
In C++
  • cin>> Function used for Input.
  • cout<< Function used for output.
Mapping between Data and Function is difficult and complicated.Mapping between Data and Function can be used using "Objects".
In C, we can call main() Function through other Functions.In C++, we cannot call main() Function through other functions.
C requires all the variables to be defined at the starting of a scope.C++ allows the declaration of variable anywhere in the scope i.e at time of its First use.
No inheritance is possible in C.Inheritance is possible in C++.
In C, malloc() and calloc() Functions are used for Memory Allocation and free() function for memory Deallocating.In C++, new and delete operators are used for Memory Allocating and Deallocating.
It supports built-in and primitive data types.It support both built-in and user define data types.
In C, Exception Handling is not present.In C++, Exception Handling is done with Try and Catch block.

Related topics:

Advertisement