C is a general purpose, flexible, high level and structured programming language. C is known as a structured programming language as the entire program is divided into several blocks, just like top-down design approach.
Why is C called Middle-level language?
C is usually called a middle-level language as it stands between high-level languages and low-level languages. This is because C language instructions resemble the normal algebraic expressions along with certain English keyword like if, else, for etc. In this respect, C resembles a high-level language. But it also posses certain low-level features that help the programmers to carry out operations available in assembly or machine languages. For example, it permits the manipulation of individual bits and also values of certain variables can be sorted within the CPU's registers to speed up the computation associated with these values.
Thus, C can be used for systems programming (eg., for writing operating systems) as well as applications programming (e.g. to solve a complicated system of mathematical equations, or for writing a program to bill customers).
Fundamentals of C programming:
- A computer can understand only two states of the electronic devices, they are ON and OFF states (1 & 0). Programming was done earlier, using only these 2 binary numbers. Every human understandable character is represented in the form of a series of 0's and 1's. This is called machine language. Example: For 'A' the machine language is 1000001.
- The drawback of Machine language: Programming using binary numbers is so difficult and debugging such a program is also very difficult.
- To make the programming task simpler, next level of programming called Assembly language was developed. In this, the operations to be performed in a computer were represented using English-like words called mnemonics.
- Advantages of Assembly Language: Reduces the length of the program and easier for programming compared to machine level coding.
- Disadvantages of Assemble language: The mnemonic codes vary from one machine to another.
High Level Language
- Programs are written using English like statements. This makes the programming easier.
- Example: C=10+2
Need for a Translator Program: Programming can be in any form (assembly language or high-level language). But a machine can understand only 0's and 1's. Thus, a software called 'Translator' is necessary to convert the programs written in high-level language/assembly language to a low level or machine language.
- It is a type of translator (a software) that directly converts the source code written in high-level language to machine language (or object code).
- It is also a type of translator (a software) which converts the high-level language program into machine language.