Tuesday, December 2, 2008

BASICS OF 'C'

Historical development of ‘C’ language-
‘C’ language is a programming language which is designed and written by a scientist Dennis Ritchie in 1972 at AT & T’S Bell Lab in USA.
In 1960, a number of languages were developed each for a specific purpose. For ex. COBAL was used for commercial application, FORTRAN for scientific and engineering applications etc. People wanted one language which can program all possible applications. An International committee was setup to design such language. This committee developed a language called ALGOL 60, but ALGOL 60 was too abstract and too general. To solve this problem another language CPL (Combine Programming Language) was designed. However, CPL was so big and so many features that it was hard to learn and difficult to implement. To solve this problem, another language called BCPL (Basic Combine Programming Language) was designed. However, BCPL never became popular because it was too general and too specific.
Around at the same time a language called ‘B’ language was designed by Ken Thompson as a further simplification to CPL. However, ‘B’ language was very specific and never became popular.
Dennis Ritchie inherited the features of CPL, BCPL and ‘B’ language and added his own to design a ‘C’ language. ‘C’ became very popular because it is simple easy to implement but a very powerful and compact programming language. ‘C’ is so powerful because it is a ‘One-Man Language’.

Why does ‘C’ called as Middle-Level Language?
All the computer languages are divided into two categories:-
1) Problem Oriented Language (High Level Language) :-
These languages are designed to give a better programming efficiency i.e. faster program development. Examples of these languages are COBAL, FORTRAN, PASCAL etc.
2) Machine Oriented Language (Low Level Language) :-
These languages are designed to give a better machine efficiency i.e. faster program executions. Examples of these languages are Assembly Language and Machine Language.
‘C’ language stands in between these two categories. Hence, it is called as a Middle Level Language. It has both a relatively good programming efficiency and a relatively good machine efficiency.
Like High Level Language, ‘C’ provides us block structure function and small amount of typing. Like Assembly Level Language, ‘C’ allows the operations on bits, bytes, words and pointers. Thus, ‘C’ has the features of both High Level Language and Low Level Language. Hence it is called as Middle Level Language.

Character set of ‘C’ language-
A character in ‘C’ is any alphabets, digits and special symbols which are used to represent information. The following table shows the character set of ‘C’ Language:-


What is a token in ‘C’ language?

A token is a single character or a sequence of characters that form a single line.
For Example:
#include
void main()
{
printf(“Welcome”)
}
The tokens in above program are - #, include, <, >, and stdio.h.

No comments: