Friday, April 25, 2014

What is the main difference between C and C++?

C is a structure oriented language where the code is organised in the form of blocks of codes that are executed to achieve the resultant output. The blocks of code can be functions, structure etc. It follows procedure paradigm.

Whereas, C++ is an object oriented language where the coding is done by using the user defined objects. Objects in turn are instances of class. Classes are based on the concept of data abstraction where all the related data and functions are grouped together and during execution instances of these classes called objects are used to refer to the data inside its respective class.

This is the main difference between C and C++. Apart from this other common differences are:
1. C files are stored with an extension '.c' whereas C++ files are stored with '.cpp'.
2. C is a low level language and is less user friendly where as C++ is a middle level language and is easily interpretable by the machine and is more user friendly too.
3. The execution in C is from top to down where as that in C++ is from bottom to up.
4. We cannot do overloading with C where as C++ supports both function and operator overloading.
->C is Procedure Oriented Programming Language (POP).
->C++ is Object Oriented Programming Language (OOP).


->C is mostly used to develop system software.
->C++ is mostly used to modal real life problem to program and use to develop application programs.


->C program has extension .C
->C++ program has extension .cpp

->C uses the top-down approach.
->while C++ uses the bottom-up approach.

->C is function-driven.
->while C++ is object-driven.

No comments: