4 Introduction to C

Programming with assembly languages is cumbersome, as we have seen in the previous chapter. For this reason, software developers write their code in high-level programming languages. A compiler then translates the program of the high-level language to the machine language. In this process, it handles many of the inevitable troubles of programming in assembly languages:

In this chapter, we study the programming language C,which remedies all of the above points. C provides abstractions to the programmer that hide the specifics of the underlying machines. As C programmers expect a translation to efficient machine code, C only provides as much abstraction as necessary to write portable programs without causing overhead. For this reason, some people refer to C as a “high-level assembler”. This intention gives C problematic properties that we will discuss later in this chapter (Section 4.15). These properties cause many severe security vulnerabilities in software written in C.

C is a very successful programming language. Every modern operating system is, because of C’s close relation to the machine language, written in C. Software for which memory consumption and execution time are important are written in C. C does not need a complex run-time environment and is rather easy to translate into machine language. This renders C the default language when developing embedded systems. Moreover, C had a strong influence on many other successful languages like C++, C#, Java, JavaScript, etc.).