Introduction to the C language
Background to C development and the authors of C Language
In 1969, Ken Thonpson and Dennis Ritchie designed a file system for the Bell Laboratories in order to provide a more convenient environment for programming . This file system evolved into an early version of the UNIX Operating system . Later, this file system was implemented on a PDPA-7 computer which was found lying idle , and in 1971 on PDP-11 . In an attempt to write a FORTRAN language compiler file the new system , Thompson , instead developed language ‘B’. Language ‘B’ was interpreter based and thus had performance drawbacks , so Ritchie developed a language C which was compiler based . In 1973, the new file system was rewritten in C language giving a trust to its acceptance among increasing numbers of users.
Feature C Language
C as a second generation and third generation language.
The C language possesses the powerful low-level features of the second-generation language like pointers, memory allocation, bit – manipulation, etc. It also supports conditional constructs, loop constructs, a rich list of operators, and a variety of data structures as in third-generation languages.
The combined features of second and third-generation language make C language a very powerful and flexible language. These features of C languages make it possible to use the language for system programming, like the development of compilers, interpreters, operating systems, graphics, and general utilities, and also for a host of applications in the commercial environment.
C Language is so powerful and flexible that ‘C’ compilers are being written in earlier versions of ‘C’ languages. Also, other language compilers, databases, spreadsheets, word processors, etc . are being developed in the C language.
Block structured language – An Advantage for Modular Programming
The C functions, available as part of the languages work as building blocks to develop more functions. Language offers all essentials of structured programming in terms of writing programs as logically defined functions, functions returning values, functions keeping private variables, etc.
C languages as such offer only a handful of functions that form the core of the language; rest of the functions, available in libraries, are developed using the core functions, offered by the language, as building blocks. This feature expands the scope and power of the language.
This leads to functionally cohesive modules and therefore reusable code.
Thus highly independent functions can be written and stored in a library containing other functions to be used as and when necessary.
Features of the C Language
Some of the features with examples showing the power of C are listed below. More about these features would be discussed in due course.
‘C’ language like other languages, allows reference to a memory location by a name assigned to it. In addition,C allows reference to a memory location by its internal address or byte number called a pointer.
In almost all programming languages memory is assigned to a variable name at the time of definition. C language also allows dynamic allocation of memory, i.e. a program itself can request the operating system to release memory for the use of the program at the time of program execution.
A function may call itself again and again (e.g. the statement ‘PERFORM A-PARA ‘within the paragraph A-PARA). This is not supported by COBOL and gives a performance overlap error. This feature, called recursion, is supported by the C language.
Bit – Manipulation
Unlike other languages, C allows manipulation of data in its lowest form of storage -BITS. For example, consider the multiplication of a number, m by 2. A familiar method to do so is to comput (m*2).another method is to shift the BITS of memory location m to the left by one position .