Navigating the 3 C Languages
Jenna EricksonJanuary 05th, 20178 minute read
Jenna is the Marketing Manager at Codal, blogger, and technology + startup enthusiast. With a responsibility of Codal's marketing programs and brand management, she is always strategizing new ways to reach clients through content and inbound marketing tactics. In her free time, Jenna enjoys traveling, cooking and reading.
In the computer programming world, it's vital to know at least one of the C languages. Most colleges require computer science majors to learn two of the three C's for their bachelor degree.
Underclassmen often ask "Which C language should I learn first?" and eventually some seniors will ask "Which C language can I afford to not learn?".
The original C language (C lang) was written by Dennis Ritchie and completed in 1973. The language really took off when Microsoft started using C lang to develop the Windows operating system in the 1980s.
Windows wasn't the only operating system developed with C lang. Linux and OSX also were born from C, as well as the early Python language compilers.
In many ways, C lang runs quicker than C++ or C# because C lang doesn't handle classes. However, if you're accustomed to programming with classes, you might find it tough to program without class and subclass inheritance in C.
Here's an example of the classic "Hello World" program written in C lang:
The first line #include <stdio.h> is a common header seen on nearly all C lang programs. Stdio.h is an abbreviation for Standard Input-Output Header. This header is what allows us to use the printf() function.
One of the most common criticisms of C lang is that it doesn't handle data mining or calculations very well. However, there's a whole language that's dedicated to those two languages exclusively, and it's called SQL.
Six years after the release of the C language, a Danish computer science student named Bjarne Stroustrup decided to combine the best parts of the Simula language with the syntax of C lang.
Simula was one of the first languages to have classes and subclass inheritance. The thesis of Bjarne Stroustrup's Ph.D was "C with Classes". In 1983 the name was changed to C++, a reference to the increment operator.
C++ was used to write the operating system for the Mac, Google Chrome, Blackberry phones, and the Apple iOS.
Microsoft switched to C++ in 1995, and continued to release operating systems written in C++ until Windows 8 was written in C# in 2012. Most of the main Microsoft Office programs (Word, Excel, Powerpoint) are still written in C++.
Some people have bought into the idea that C++ is a dying language and is being replaced by C# and Google's GoLang.
While it is true that Windows has been writing their operating systems in C# since 2012, Apple still uses both C++ and C# in their operating systems.
Although Microsoft and Apple will inevitably migrate to C# exclusively for operating system development, C++ game development is here to stay.
Game engines written in C++ can reach and sustain higher framerates than the engines written in C#. Electronic Arts and Microsoft have both confirmed that they will remain loyal to the C++ language in game development.
One of the things that distinguishes C++ programs from C and C# are the syntax for double colon (::) and insertion (<<). We can see these two operators in the rosetta stone of programming languages known as Hello World:
The hash mark (#) tells the compiler that we need to preprocess the first line in order for the rest of the program to work. The hash mark is almost exclusively used with import statements.
<iostream> is the package that allows us handle input and output.
The fourth line feeds the string "Hello World" into the standard character output device abbreviated as std::cout.
Microsoft developed C# in 2000 to be a general-purpose language. Being the most modern of the C language means that it is highly versatile.
Object oriented and procedural programming are both fair game in C#, but event-driven programming is what really sets C# apart from the other two languages.
Event driven program occurs when the flow of the program is determined by events such as mouse clicks or keystrokes.
Most of the programs for Windows 8 and beyond are written in C#. The language seems to be becoming more popular with time. During the early years of C# many developers outside of Microsoft were reluctant to learning C#.
Here's an example of "Hello World" in C#:
You may notice that C# reads very much like a java program. If you're a fan of the Java programming language, you will likely enjoy C#. Some programmers go as far as describing C# as Java remastered.
Conclusion: Youth is Served
The youngest of the C languages is C#, and therefore it is the most versatile. During the mid 2000s, when operating systems were still made exclusively on C++, you could make the argument that C# was just an application level language.
But now that Windows and Apple are both writing operating systems in C#, C++ is slowly passing the baton to C#.
However, C++ isn't disappearing anytime soon, especially for aspiring game developers.
The original C language is still used and taught in many programming schools. Part of the appeal to learning C lang today is that it's smaller and easier to learn than the other two evolutions of C.
That being said, if you're accustom working with classes and subclasses, you might find yourself frustrated by the fact that C lang doesn't support class inheritance.