All the major difference between C and C++

All the major difference between C and C++

All the major difference between C and C++, that’s what i am going to tell you. Before that, let’s learn some history about C and C++.

The programming language “C”, was developed and introduced by Dennis Ritchie in 1972. C is a structure oriented programming language, most of it’s featured were derived from Basic Combined Programming Language, also know as BCPL.The main implementation area of C was UNIX operating system. In 1983, the ANSI or American National Standards Institute, founded a committee to provide a modern and comprehensive definition for C, later known as “ANSI C”.

C++ was developed by Bjarne Stroustrup starting in 1979, at famous Bell Labs. C++ is an object oriented programming (OOP) language and it’s actually an extension of C language. C++ also pronouns as “C-Plus-Plus”.

Now, i am going to list all the major difference between C and C++.So, let’s take a look.

All the major difference between C and C++

All the major difference between C and C++
C C++
C is a structural or procedural programming language or Procedural programming paradigm C++ supports both procedural and object oriented programming paradigms. Mainly, Object Oriented Programming (OOP).
C is not Object Oriented Programming Language. Therefore it do not support Encapsulation, Inheritance, Polymorphism Support Encapsulation, Inheritance, Polymorphism
Based on Procedure (Steps) to solve any problem Based on objects rather than procedures
In C, functions and data are separate and free entities ( This is due to it’s procedural programming language nature) In C++,functions and data are encapsulated as an object. Class provides the structure of an Object
Fundamental building blocks are Procedures Fundamental building blocks are Objects
Data, manipulated outside the code. Because this information hiding/encapsulation not possible Encapsulation, encapsulates the data to make ensure that data structures and operators are used as intended
C, uses Top Down Approach C, uses Bottom Up Approach
C, is a Function driven language C++,  an Object driven language
scanf() and printf() functions for std input and output cin>> and cout<< for std input and output
C, not supports Function and Operator overloading C++, Supports both Function and Operator overloading
In C, Variables defined at the beginning. In C++, Variables can define anywhere in the function
In C, Do not allow Functions inside Structures In C++, Allow Functions inside Structures
Namespace are not possible Namespace are possible
Do not support Reference variables Supports Reference Variables
Middle Level Language High Level Language
Do not support Virtual and Friend functions Support both Virtual and Friend functions
In C, Programs are divided into modules and functions In C++, Programs are divided into classes and functions
malloc() and calloc() functions are used for dynamic memory allocation. Also, free() for memory de-allocation new operator for memory allocation. Also, free operator for memory de-allocation
Doesn’t support exception handling directly Supports exception handling. By using try and catch block
Uses extention “.C” for saving file Uses extention “.CPP” for saving file

I hope you like this article, All the major difference between C and C++. And also hopes that, you understand all the points mentioned above. If you have any doubts or anryexamples, drop your comments below.

Leave a Comment

Your email address will not be published. Required fields are marked *