Blog - Tutorials

What is the difference between C, C++, Objective-C, and C#?

Written by: Dan C, on 2014-09-08

C, C++, C# and Objective C are a set of similarly named programming languages, some of which are related and some of which are not. C, C++, Objective-C and C# are not different variations of the same programming language.

C is the oldest of these languages and the most popular programming language ever made. C was originally created as a systems programming language for the Unix OS, and is still widely used today for applications programming. One big reason is that programs written in C can run on all sorts of different operating systems with only small tweaks.

C++ is a very popular, general-purpose programming language, originally based on C. It was originally called “C with Classes”. With some tweaking, most C code can be made to compile as C++ code. C++ adds a large set of language features which change the way the language is used significantly from the way C is used. It is generally considered a bad practice to write C-style code in C++.

Objective-C is a strict superset of C meaning it can do everything C can, but also has a few extra features. These features were pulled from a language called Smalltalk, and like C++, were mainly focused on making the language more object-oriented. All valid C code is also valid Objective-C code. Objective-C is not nearly as popular as C or C++, and is mainly used today in development for Apple’s OS X and iOS platforms.

C# is not based on C in any technical sense. C# is a general purpose language designed by Microsoft and is similar in many ways to the Java language. It compiles down to an intermediate form which runs in a virtual machine (CLR), unlike the previous three languages which are all compiled to native machine code. While C# borrows syntactic elements from C and C++ (as does Java), it has no real technical relation to those languages.