About C
The C Programming Language was created in 1972 by Computer Science legend Dennis Ritchie at Bell Labs, and went on to become one of the most used languages of all time, while also being extremelly influential over languages that came after it.
At the time when C was created, there were very few high level languages available. Most programs were written using assembly language, which is little more than a textual representation of binary code, and requires the programmer to completely control the memory layout — i.e., how each byte of memory is used — of the program and to understand how the machine instructions work in great detail. Even advanced programmers who had such skills would still suffer from the effort-intensive and error-prone process of writing down long lists of commands which are so close to the hardware. To address this issue and facilitate the development of the then emerging Unix operating system (which later would be the basis to the creation of Linux, FreeBSD and MacOS, among other modern operating systems), Dennis Ritchie created C and designed it to be a "high level assembly".
Basically, C offers features of high level languages — such as built-in data types that can be composed and manipulated conveniently instead of manually organizing the memory; variables and expressions to easily express calculations; and functions (blocks of commands with a name), which enables improving the code organization by using modularization and layers of abstractions —, while still offering low level operations, such as referring to a memory locations directly.
Why use C?
Its characteristics made C ideal as a language for systems programming, which is the development of software that handles the hardware directly, such as operating systems, device drivers and embedded software. Writing the Unix source code in C made it much easier to port it to many environments — i.e., as long as there is a C translator for the target environment, the code could still work with little modification even if the machine instructions were different.
Additionally, because C syntax is so close to machine instructions, it is relatively easy to create a C translator (when compared to other languages), and it can be highly optimized to best use the resources available on the target hardware. For this reason, the other major use case of the C Language is for the development of software libraries, i.e. bundles of small utility code that can be integrated into new applications to speed up performance critical operations, such as video/image processing, cryptography, networking, calculation intensive simulations, among others. This is also the reason why video games are usually written using C or its sister, C++, which has similar features.
Tip
C is such a widely supported and efficient language that it is most common that higher level languages — such as Java, JavaScript, Pyhton, C#, among many others — implement their standard libraries, i.e, the built-in software libraries available by default to the programmer, using C, and make it available by using "wrappers" that execute the optimized C code behind the scenes. This is also a common strategy for non-standard libraries created by the community of programmers that use these high level languages.
Developing in C
C is a compiled language. This means that you need a compiler installed on your machine before you can write any programs. Although there are probably hundreds of C compilers available, there are 3 that are most commonly used:
MSVC is available for Windows only, but GCC and Clang are available for Linux, MacOS, and Windows. The next section explains how to prepare your environment to use each of these compilers. In this tutorial, we will use only a standard version of C, so there is no practical difference between these compilers with regards to the code, but there is a different way of invoking the compiler, i.e, actually executing it to read source code and generate executable files. Select your compiler's tab on each code example, and the proper command will be shown.
For the simplest case, when we have a single source file that we want to compile, the compilation process is quite simple (Fig. 1). However, as applications become more complex, it becomes necessary to split our code into multiple source files, and to use third-party libraries that provide some functionalities that we cannot or do not want to implement ourselves. In that case, the compilation process becomes increasingly more complex, and takes many steps (Fig. 2). Right now, we won't worry about this case. Much later in the tutorial, we will explain how you can organize your code to use many files, and how to compile it correctly in this scenario.
For now, move on to the next section, set up your environment, and have a nice journey!