Introduction to C Programming Language

In order to communicate any idea, thought, instruction or information, humans make use of spoken language. The fact is that you have just understood the very first sentence of this chapter all due to that. However, spoken languages are not understood by machines. Not only machines but also other living creatures of this planet do not understand spoken languages. Hence, they need some different kind of a language. As an example, a ring master in circus uses the movement and sound of a whip to control the beast. Similarly, machines like cars understand mechanical motions such as the movement of steering wheel, brake pedal and so on, to perform specific actions. This means whenever some instruction is to be communicated to any living or non-living thing, we need some kind of a specific language that is understood by it. As such, computer is not an exception.

In order to communicate instructions to a computer, humans need a language which we call a programming language. Like we have a variety of spoken languages, we also have a variety of programming languages. However, computers nowadays are digital and only understand the language of 0’s and 1’s. Therefore, to instruct a computer to perform some specific task we have to put these 0’s and 1’s in a particular sequence. This kind of a programming language is called Machine Language. A set of these instructions is called a Program like a set of dialogs in a spoken language is called a Conversation. Communicating instructions to a digital computer in machine language is difficult, error prone, non-portable and so on. To overcome some of its drawbacks (specifically difficulty) an assembly language can be used which actually uses mnemonics for these strings of 1’s and 0’s. Indeed assembly language is not understood directly by a computer and hence a translator (which is called assembler) is required to convert these mnemonics into binary strings. A translator converts a source program written in some programming language into executable machine code. Machine and Assembly language, both called low-level programming languages, are highly machine dependent, error-prone, difficult to understand and learn, and so on. A high-level programming language is machine independent, less error-prone, easy to understand and learn, and so on. In this language, the statements (or instructions) are written using English words and a set of familiar mathematical symbols which makes it easier to understand and learn, and is thus less error-prone. Furthermore, the language is machine independent and hence can be ported to other machines. The high-level programming languages can be further
classified into procedural, non-procedural and problem oriented languages. This text discusses the vocabulary, grammatical rules and technical aspects of a high-level procedural language called C. It must be noted that all high-level languages also need a translator to convert it into machine language. Depending upon whether the translation is made to actual machine code or some intermediate code, the translator is called a Compiler or an Interpreter respectively. C programming language uses a compiler to convert the instructions into actual machine code. Some researchers also classify C language as a middle level language. The reason behind this is that assembly code can also be mixed with C code.