Difference between C and C++.


C programming Language

C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972.

In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard.

The UNIX operating system, the C compiler, and essentially all UNIX application programs have been written in C. C has now become a widely used professional language for various reasons −

  • Easy to learn
  • Structured language
  • It produces efficient programs
  • It can handle low-level activities
  • It can be compiled on a variety of computer platforms

C++ programming Language

C++ is a statically typed, compiled, general-purpose, case-sensitive, free-form programming language that supports procedural, object-oriented, and generic programming.

C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features.

C++ was developed by Bjarne Stroustrup starting in 1979 at Bell Labs in Murray Hill, New Jersey, as an enhancement to the C language and originally named C with Classes but later it was renamed C++ in 1983.

C++ is a superset of C, and that virtually any legal C program is a legal C++ program.

Note − A programming language is said to use static typing when type checking is performed during compile-time as opposed to run-time.

Object-Oriented Programming

C++ fully supports object-oriented programming, including the four pillars of object-oriented development −

  • Encapsulation
  • Data hiding
  • Inheritance
  • Polymorphism

Differences

Following are the important differences between C and C++.

Sr.No. Key C C++
1 Developer C developed by Dennis Richie between 1969-1973 at AT&T Bell Labs. C++ developed by Bjarne Stroustrup in 1979.
2 OOPS C does not support OOPS concepts like polymorphism, encapsulation, and inheritance. C++ is a object oriented programming and supports OOPS concepts like polymorphism, encapsulation, and inheritance.
3 Set C is a subset of C++. C++ is superset of C. All code of C can run in C++ but vice versa may or may not be true.
4 keywords C has 32 keywords. C++ has 52 keywords.
5 Procedural vs OOPS C is a procedural programming language. C++ supports both procedural as well as object oriented programming.
6 Data and Function Data and Functions are separate in C. GData and Functions are encapsulated together as object in C++.
7 Information Hiding Information Hiding is not supported in C. Information Hiding is supported in C++ via encapsulation.
8 Overloading Function and Operator overloading is not supported in C. Function and Operator overloading is supported in C++.
9 Function C is function driven language. C++ is Object driven language.
10 Structure C structure do not support defining functions. C++ Structure supports defining function.
11 Reference Variables Reference Variables are not supported in C. Reference Variables are supported in C++.
12 Virtual and friend functions Virtual and friend functions are not supported in C. Virtual and friend functions are supported in C++.
13 Exception Handling Exception handling is not supported in C. Exception handling is supported in C++.

Updated on: 19-Aug-2022

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements