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.
Basis | C | C++ |
---|---|---|
Programming language Type | Procedural programming language | Multi-paradigm programming language as it supports OOPs, procedural programming and functional programming. |
OOPs features | Doesn't support OOPs features | It supports OOPs features ranging from Classes to Polymorphism |
Dynamic memory allocation | malloc(),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 |
Overloading | Function overloading and Operator overloading are not supported | Function overloading and Operator overloading are supported |
Focuses on | Method and process | Method and procedure |
Datatypes | Only Built-in is supported | Only Built-in and user defined data types are supported |
Reserved Keywords | 32 | 52 |
Virtual ,inline and friend functions | Not Supported | Supported |
Exception handling | Not supported | Supported |
Header file for Standard input and output | iostream | stdio.h/cstdio |
Input and output operations | scanf and printf | cin and cout |
Inheritance | Not Supported | Supported |
Reference Variable | Not Supported | Supported |
Namespace | Not Supported | Supported |
Information hiding | Not supported | Encapsulation feature is used for hiding data |
Polymorphism | Not supported | Supported |
Approach | Follows Top-Down approach | bottom-up approach |
Extension | A program is saved with file extension .c | A program is saved with file extension .cpp |
Developed by | Dennis Ritchie | Bjarne Stroustrup |
Driven by | Function-driven | Object-driven |
Successor of | B language | C 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.
– Easy to learn
– System programming language
– Code reusablity
– Vast community
– Can be used for developing a large range of applications
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.
– Support for OOPs features
– Easy to learn and understand
– Exception handling
– Allow Operator Overloading
– Support for generic programming
This post was last modified on January 2, 2021