What is the difference between C and C++?


What is the difference between C and C++?


The biggest fundamental difference between the C computer language first released in 1972, and the C++ programming language released in 1983, almost 10 years later, is that the original C is an example of a procedural computing language, while C++ is a representation of the principles of object-oriented programming (OOP). As a result, C++ supports classes and objects, new ways to structure code and new ways to think about programming.

A procedural programming language uses procedure calls to carry out sequential steps of computer instructions by breaking down code into variables, data structures and subroutines.

Object-oriented programming is a bit different. In object-oriented programming, objects contain various attributes, and also procedural code that is called methods.

The philosophy of objects means that object-oriented programs work in new and different ways as evidenced by Bjarne Stroustrop, the creator of C++, for example, in a 1991 paper entitled “What is 'Object-Oriented Programming'?” in which the programmer lays out essential elements that distinguish OOP programming languages and constructs from others.

In particular, C++ provides solutions such as encapsulation and namespaces for variables, and improves on certain error-handling processes. Another positive aspect of object-oriented programming allows for object reuse and other various manipulations of the object as a data item. The intersection of classes and objects (and object instances) tells programmers a lot about the ideas and the possibilities behind OOP, distinguishing this approach from older “linear” code models used by early languages such as BASIC and Fortran. OOP is, in many ways, a divergence from the old way of line-based computing, and a foray into the world of virtual objects and more sophisticated data modeling.

The main difference is that C++ builds on the procedural C language by adding the functionalities that represent the object-oriented programming philosophy. For this reason, C++ became widely used in the era of OOP, in conjunction with other OOP languages such as Microsoft Visual Basic.

Have a question? Ask us here.

View all questions from Justin Stoltzfus.

Share this:
Written by Justin Stoltzfus
Profile Picture of Justin Stoltzfus

Justin Stoltzfus is a freelance writer for various Web and print publications. His work has appeared in online magazines including Preservation Online, a project of the National Historic Trust, and many other venues.