Diff betn c and c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Diff betn c and c++

a

29th Nov 2016, 7:10 PM
Dnyandev Borkar
Dnyandev Borkar - avatar
2 Answers
+ 2
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 combination of both procedural and object oriented programming language; therefore C++ can be called a hybrid language.
29th Nov 2016, 7:32 PM
Aliakbar Rezapour
Aliakbar Rezapour - avatar
+ 1
Most of C is a part of C++ (let's say 99% compatibility between C and C subset of C++) so C++ is extended C. Most notable extensions are: standard library, classes, templates (similar to generics in C# or Java but less restricted), exceptions, RAII techniques for scoped resource cleanup (meaning you can have worse memory in your head but still not leak memory, file handle and other resources in your program by design) and references which are safer to use than pointers and from C++11 on some extra syntactic shugar such as lambda functions and ranged for loops (known as foreach loops in some other languages). Overall C++ provides all the capabilities of C while adding advanced abstractions similar to other high level languages such as C# and Java but with zero overhead prnciple in mind (meaning you don't pay in performance what you don't use and that the compiler manages to optimize alot of abstractions away during compile time so there is no overhead at runtime - sometimes even better performance than without abstractions like for e.g. C sort often performs worse than C++ std::sort even though the lader is a template abstraction while the former is a raw function).
29th Nov 2016, 10:45 PM
Domen Vrankar
Domen Vrankar - avatar