C vs C++

In this tutorial you will learn about the C vs C++ and its application with practical example.

C vs C++

What is the difference between C and C++?

The major difference between C and C++ is that C is a procedural programming language and does not support the concept of classes and objects, while C++ is a combination of both procedural and object-oriented programming languages. C++ is considered a superset of C, which means C++ includes features of C programming language and in addition their own features.

Difference between C and C++

C C++
C is a procedural programming language. C++ is a Object-Oriented Programming language.
C follows Top Down programming approach C++ follows Bottom Up programming approach.
The extension of a C program file is .c The extension of a c+ + program language is .cpp
C is a function driven language. C++ is an object driven language.
In C, structure does not support declaring of function as its member While, in C++ structure provides the feature of declaring a function as a member function.
C does not support inline function. C++ supports inline function.
In C scanf and printf functions are used for standard input and output operation In C++ cin and cout objects are for standard input and output operations.‬ ‬‬‬
C is not compatible with another language. C++ is compatible with the other generic programming languages.
C does not support operator overloading. C++ support operator overloading.
In C, the variable should be defined at the beginning of the program. C++ allows you to declare variables anywhere in the function.
C does not support reference variables C++ support reference variables
C does not allow you to use function overloading. C++ allows you to use function overloading.
C language does not allows you to declare String or Boolean data types. It supports built-in and primitive data types. C++ supports String and Boolean data types.
C does not support Exception Handling. However, it can be performed using some workarounds. C++ supports Exception handling. Moreover, this operation can be performed using try and catch block.
Does not allows functions with default arrangements Allow functions with default arrangements.
C does not have namespace feature. It is present in the C++.
C is a subset of C++. It cannot run C++ code. C++ is a superset of C. C++ can run most of C code.
Does not support encapsulation. As Data and functions are separate and free entities. Supports encapsulation. Data and functions are encapsulated together as an object.
C does not support information hiding. In this language, data are free entities and can be changed outside code. Encapsulation hides the data. So that data structures and operators are used as per intention.
C provide malloc() and calloc() functions for dynamic memory allocation. C++ provides a new operator for this purpose.
C, allows Multiple Declaration of global variables. In C++, Multiple Declaration of global variables are not allowed.
In C, Inheritance is not supported. Inheritance is possible in C++ language.
Virtual Functions are present in C. Virtual Function is not used in C++.
Contain 32 keywords. Contains 52 keywords.
Polymorphism is not possible Polymorphism is one of the most Important Features of OOPS.
C language offers GTK tool for GUI programming C++ supports Qt tools for GUI programming

In this tutorial we have learn about the C vs C++ and its application with practical example. I hope you will like this tutorial.