Difference between C++, C and C#

It helps to think of programming languages in terms of how closely they are able to control what a computer is actually doing.  These are commonly classified as low-, intermediate- and high-level programming languages.  Computers execute machine code, and assembly language is considered the lowest level programming language; it is a human readable version of machine code.

C was created to provide a structural programming language that is easier to use than assembly.  It is considered a low-level programming language with little to no loss in performance relative to assembly.  This made C the natural choice for building operating systems and low-level software on computers because it allowed for easier development at near-assembly performance.

C++ is essentially an extension of C. The original C++ compilers just pre-compiled directly into C, which was then compiled to machine code, while modern C++ compilers can easily compile C or C++ into machine code.  C++ was designed to allow developers to use all of the existing features of C but provides a number of extensions to support object-oriented programming techniques in an intermediate-level programming language.

C# is a complete outlier in this list.  Despite it’s name, it has far more in common with Java than C or C++.  C# is an object-oriented, high-level programming language.  Like Java, C# provides a number of features to make it easier for a developer to code in this language such as type checking, bounds checking, uninitialized variable checking, and garbage collection.  While the language does not technically specify how it is executed, C# is most commonly compiled into byte-code (rather than machine code) and executes on a virtual machine (like Java) that converts the application into machine code on the fly.

Developers who are focused on performance still pick C or C++ as their language of choice.  Nearly all operating systems (kernel and low-level system software) are written in C, C++ or some combination of the two.  Most high-profile server and desktop software is also written in C++.  For example, most web browsers, office suites and games are written in C or C++.  C# remains a common choice for internal/enterprise applications but is less common forcommercial software.

Leave a comment