+ 5
What are the differences between C and C++?
Please tell what makes C++ different from C. What are the new features in C++, etc., etc.
2 ответов
+ 2
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.
0
One of the main differences is that C is a procedural programming language that wasn't designed for object oriented functionality, and C++ adds clean object oriented concepts to C based syntax. C++ has even been referred to as "C with classes". So most OOP concepts like classes, inheritance, polymorphism, etc aren't easily available in C. Other differences include easier error handling with exceptions in C++, naming conventions and more.