1. What is the main difference between c and c++ ?

C C++
C is a structured programming language. C++ is an object oriented programming language.
C language is not in solving the real time problem. C++ works well in solving real time problem.
Polymorphism is not possible. Polymorphism is used in C++.
In C, malloc() and calloc() Functions are used for
Memory Allocation and free() function
for memory Deallocating.
C++, new and delete operators are used for Memory Allocating and Deallocating.
Operator overloading is not possible in C. Operator overloading is one of the greatest Feature of C++.
No namespace Feature is present in C Language. Namespace Feature is present in C++ for avoiding Name collision.
scanf() function used for input and printf() function
used for output.
Cin function used for input and Cout funtion used for output.
Polymorphism, Operator Overloading Concept is not
possible in C.
Polymorphism, Operator Overloading Concept is the most important feature in C++.
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.
Exception Handling is not present in C. Exception Handling is done with Try and Catch block.

Categorized in:

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,