Difference Between C And C++ – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Sat, 02 Jan 2021 16:06:53 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg Difference Between C And C++ – Programmerbay https://programmerbay.com 32 32 Difference Between C And C++ in Tabular Form https://programmerbay.com/difference-between-c-and-c-in-tabular-form/ https://programmerbay.com/difference-between-c-and-c-in-tabular-form/#respond Tue, 31 Mar 2020 16:01:00 +0000 https://www.programmerbay.com/?p=2652 C and C++ or ‘C with Classes’ are programming languages that are very popular and widely used in development environments. The major difference between C and C++ is, C only supports procedural language whereas C++ is an upgraded version of C as it supports object oriented programming as well as  procedural programming.

difference between c and c

Difference between C and C++ in Tabular Form

BasisCC++
Programming language TypeProcedural programming languageMulti-paradigm programming language as it supports OOPs, procedural programming and functional programming.
OOPs featuresDoesn't support OOPs featuresIt supports OOPs features ranging from Classes to Polymorphism
Dynamic memory allocationmalloc(),realloc() and calloc() functions are used for dynamic memory allocation"new"' operator is used for this purpose
Memory Deallocation free() is used to deallocate memory delete operator is used to release memory
OverloadingFunction overloading and Operator overloading are not supportedFunction overloading and Operator overloading are supported
Focuses onMethod and processMethod and procedure
DatatypesOnly Built-in is supportedOnly Built-in and user defined data types are supported
Reserved Keywords3252
Virtual ,inline and friend functionsNot SupportedSupported
Exception handling Not supportedSupported
Header file for Standard input and outputiostreamstdio.h/cstdio
Input and output operationsscanf and printfcin and cout
InheritanceNot SupportedSupported
Reference VariableNot SupportedSupported
NamespaceNot SupportedSupported
Information hidingNot supportedEncapsulation feature is used for hiding data
PolymorphismNot supportedSupported
ApproachFollows Top-Down approachbottom-up approach
ExtensionA program is saved with file extension .cA program is saved with file extension .cpp
Developed byDennis RitchieBjarne Stroustrup
Driven by Function-drivenObject-driven
Successor ofB languageC language

C Programming Language

It is a general purpose and procedural programming language that was initially developed by Dennis Ritchie at AT & T’s Bell Laboratories of USA in 1972.At the beginning, it was intended to be a language for developing operating systems and system related applications. Further, It supports vast community and is very popular language that you can learn and find solution of problem easily, if you get stuck.

Features of C:

– Easy to learn
– System programming language
– Code reusablity
– Vast community
– Can be used for developing a large range of applications

C++ Programming Language

C with Classes or C++ is an upgraded version of C programming language. It was developed by Bjarne Stroustrup at bell labs in 1985.
It is a modern programming language that provides support for OOPs features, such as Classes, Abstraction, Inheritance, Polymorphism and more.

It can be viewed as intermediate language as it has features of procedural language as well as Object oriented programming language. Though, C++ has the features of OOPs but it can’t be considered as completely object oriented.

Features of C++:

– Support for OOPs features
– Easy to learn and understand
– Exception handling
– Allow Operator Overloading
– Support for generic programming

Key Differences

  1. Dennis Ritchie at AT&T Bell Laboratories developed the C programming language, whereas; in the year of 1979, Bjarne Stroustrup developed the C++ programming language.
  2. C language does not support object-oriented programming approaches which clearly means that there is no support for inheritance, polymorphism, and encapsulation, etc., whereas; C++ language supports object-oriented programming approach which clearly indicates that there is support for inheritance, polymorphism and encapsulation, etc.
  3. C++ language codes cannot be run on C language platform which means that C is a subset of C++ language, whereas; C language codes can be executed on C++ language platform which means that C++ is a superset of the C language.
  4. In the C programming language, there is clear support for only procedural programming paradigm for writing the code, whereas; in the C++ programming language there is a combination of object-oriented paradigm and also procedural programming paradigm.
  5. The C language is a Procedural programming language which means that the function and data are kept away from each other, whereas; the C++ language there is a concept of objects which contains both the function as well as data.
  6. As the C programming is comparatively old as compared to C++ and thus there is no data hiding support at all, whereas; in the C++ language there is full support for the data hiding in the realm of the encapsulation.
  7. In C language there is only support for data types that are built in, whereas; in C++ language there is support for both the data types such as user-defined and built-in data types.
  8. In C programming language there are exactly about 32 keywords, whereas; in C++ programming languages there are exactly about 52 keywords.

]]>
https://programmerbay.com/difference-between-c-and-c-in-tabular-form/feed/ 0