Helpline : +91 - 9242079119

What is the difference between C and C Plus Plus?

What is the difference between C and C Plus Plus?

Difference Between C and C++ Programming Languages

Author : Javed

Date : Jan -02, 2018

Tags : Anjular Js Course and JQuery Course, ANGULARJS 2, JQuery Course Online Training Be Practical online marketing courses


A Comparison – C structures and C++ structures Be-Practical | Bangalore, India

Let’s learn the major differences between C and C++ programming languages. C++ offers excellent object orientation programming (OOP) paradigm. Nevertheless, C is still the most widely used in software development.

This is one of the most asked question in the Computer Science courses. If you have done a computer science, information technology or related courses, chances are that you’ve faced this question asking you to explain “major differences between C and C++ programming languages”. And of course, most of you would have listed several such differences. Let’s explore this important question and make a comprehensive list of differences between C and C++

Before, we get into a bit technical stuff let’s recap what are C and C++. Well, C is probably the most widely used computer programming language. C was originally developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs. The reason why C has been so popular lies in the efficiency with which C converts into machine instructions. This efficiency has made the applications written in C super-fast.

Basic Introduction:

  • C++ is derived from C Language. It is a Superset of C. 
  • Earlier C++ was known as C with classes. 
  • In C++, the major change was the addition of classes and a mechanism for inheriting class objects into other classes. 
  • Most C Programs can be compiled in C++ compiler. 
  • C++ expressions are the same as C expressions. 
  • All C operators are valid in C++. 


Following are the differences Between C and C++ :

                               C                               C++
1. C is Procedural Language. 1. C++ is non Procedural i.e Object oriented Language.
2. No virtual Functions are present in C 2. The concept of virtual Functions are used in C++.
3. In C, Polymorphism is not possible. 3. The concept of polymorphism is used in C++.
Polymorphism is the most Important Feature of OOPS.
4. Operator overloading is not possible in C. 4. Operator overloading is one of the greatest Feature of C++.
5. Top down approach is used in Program Design. 5. Bottom up approach adopted in Program Design.
6. No namespace Feature is present in C Language. 6. Namespace Feature is present in C++ for avoiding Name collision.
7. Multiple Declaration of global variables are allowed. 7. Multiple Declaration of global varioables are not allowed.
8. In C
  • scanf() Function used for Input.
  • printf() Function used for output.
8. In C++
  • Cin>> Function used for Input.
  • Cout<< Function used for output.
9. Mapping between Data and Function is difficult and complicated. 9. Mapping between Data and Function can be used using "Objects"
10. In C, we can call main() Function through other Functions 10. In C++, we cannot call main() Function through other functions.
11. C requires all the variables to be defined at the starting of a scope. 11. C++ allows the declaration of variable anywhere in the scope i.e at time of its First use.
12. No inheritance is possible in C. 12. Inheritance is possible in C++
13. In C, malloc() and calloc() Functions are used for Memory Allocation and free() function for memory Deallocating. 13.In C++,  new and delete operators are used for Memory Allocating and Deallocating.
14. It supports built-in and primitive data types. 14. It support both built-in and user define data types.
15. In C, Exception Handling is not present. 15. In C++, Exception Handling is done with Try and Catch block.

 

C++ is the object oriented and updated version of C language.Therefore, C++ not only shares a lot of C features but also provides new features, such as object-orientation. As a result, most of the C++ compilers can also compile C programs. Following Vann diagram shows how C and C++ share features and how different they are:

.A Comparison – C structures and C++ structures Be-Practical | Bangalore, India

The following graph shows the usage of various programming languages between 2002 and 2015.

Comparison of usage of various programming languages during 2002 and 2015. Source: Be Practical Training Institute index.

Comparison of usage of various programming languages during 2002 and 2015. Source: TIOBE index.

As you can see, the use C language has been more or less steady during last 14 years. In comparison, Java and C++ have been going out of favor.

: +91 - 9242079119