I’ve always wondered what are the differences between these three languages. In my freshman year, we first learned about C and then advanced into C++. For higher years, the language used no longer mattered, although there were still restrictions. Even though I have programmed extensively with C and C++ before, I didn’t get a chance to thoroughly know the differences from a broad, general perspective.
So, here comes this article.
There are plenty of differences in features between these languages (or else they won’t be “different” languages). My attempt in this article is to introduce the differences and cover the most important features. If you wish to read about more detailed differences, I encourage you to go to the links at the end of this article.
Note that both C++ and C# are part of the bigger family of C languages. Most family members are no longer in use.
C
Paradigms: imperative, procedural, structured
The C language is the oldest. It was invented by Dennis Ritchie in 1972 at Bell Labs to write operating systems. It was developed as an augmented version of B for the development of a new version of Unix.
It has the properties of both low-level and high-level languages. It is a good language to develop computer code systems. GeeksforGeeks calls it a middle-level programming language. Some call it a low-level language since it operates almost as efficient as assembly code. Note that what determines if a language is low-level or high-level is its level of abstraction from details of the computer. High-level languages suffer from abstraction penalty, defined by Wikipedia as “the cost that high-level programming techniques pay for being unable to optimize performance”.
(Just for fun: the first high-level programming language is the FORTRAN, owned by IBM, released in 1957)
It gained popularity in the 1980s, and then became the most widely used programming language in embedded applications and operating systems.
It is a good starting programming language for beginners since it is the foundation of many newer languages. It is simple and does not have many advanced features of newer languages, so you would have to build things from scratch. This helps you to understand the underlying process of how algorithms/programs/memory/computers work, which is not possible with many higher-level languages such as Python. Here are some arguments on Quora on why C should be the starting language.
What to remember:
- C is the oldest of the three. It is an imperative, procedural programming language. Many new languages were built upon it. It is mostly used to develop operating systems.
C++ (“C plus plus”)
C++ is “C with classes”.
“++” is the increment operator in C.
C++ was developed as an extension to C, to add object-oriented capabilities without sacrificing the efficiency in C.
It was created by Bjarne Stroustrup and was published in 1985. It can be used alongside C to develop operating systems.
New features of C++ include operator overloading, references, improved type checking, and more.
The features of C++ were updated continuously. With C++2.0, features such as abstract classes, static/const/protected member functions, and multiple inheritances.
Paradigms: procedural, functional, object-oriented, generic
What to remember:
- C++ is an extension to C. Although it has many new features, its most notable difference to C is that it supports OOP.
C# (“C-Sharp”)
C# is an extension of C that is based on the .NET framework.
Similar to C++, the name C# indicates an “incrementation” to C. In music, a sharp indicates that a note should be made one semitone higher in pitch. However, it has more commonalities with Java than with C/C++.
It was developed by a team at Microsoft led by Anders Hejlsberg in 2002 to compete with Java. At first, its name was Cool, which stood for “C-like Object-Oriented Language”. James Gosling, the creator of Java, called it an “imitator” of Java. He also said that “[C# is] sort of Java with reliability, productivity and security deleted.” However, since 2005, C# and Java started to diverge into two different programming languages.
Unlike C and C++, pointers in C# can only be used in unsafe mode.
The biggest between C# and C/C++ is that it uses component-oriented programming in addition to OOP. Here is an article about COP vs. OOP. Quoting from an article from C# Station: “Component-oriented programming uses exchangeable code modules that work on their own and don’t need you to know their inner workings to use them.”
Wikipedia paradigms: Structured, imperative, object-oriented, event-driven, task-driven, functional, generic, reflective, concurrent
What to remember:
- C# is an extension of C, but it has more commonalities with Java than with C. The biggest difference between C#and C/C++ is that it has component-oriented programming in addition to OOP.
Further Reading
C as the first language: https://www.quora.com/Is-C-a-good-first-programming-language
C/C#: https://www.geeksforgeeks.org/difference-between-c-and-c-sharp/
Differences: https://csharp-station.com/understanding-the-differences-between-c-c-and-c/
Component-oriented programming vs. OOP:https://www.oreilly.com/library/view/programming-net-components/0596102070/ch01s02.html