Introduction to C

Introduction to C The C language was first developed in 1972 by Dennis M. Ritchie at Bell Telephone Laboratories Inc. (now a part of AT & T) as a system programming language i.e. a language to write operating systems and system utilities. An operating system is a program that manages the resources of a computer besides functioning as an interface between the user and the machine. It controls the entire operations of the computer. The resources of a computer include the CPU, main memory, disks and other devices such as printer that are connected to the computer. Ritchie’s intent in designing C was to give programmers a convenient means of accessing a machine’s instruction set. This meant creating a language that was high-level enough to make programs readable and portable, but simple enough to map easily onto the underlying machine. We can call C as a middle-level language since it stands between the low-level and HLL categories i.e. it results in good programming efficiency as well as good machine efficiency. C is so flexible and enables compilers to produce such efficient machine code that in 1973, Ritchie and Ken Thompson rewrote most of UNIX operating systems in C. Programming in C 9 C is characterised by the ability to write very concise source programs due to the large number of operators included within the language. It has a relatively small instruction set, though actual implementations include extensive library functions which enhance the basic instructions. Furthermore, the language encourages users to write additional library functions of their own. Thus the features and capabilities of the language can easily be extended by the user. C compilers are commonly available for computers of all sizes and C interpreters are becoming increasingly common. Another important characteristic of C is that its programs are highly portable, even more than those with high-level languages. Therefore, most C programs can be processed on many different computers with little or no alteration. During the earlier stages, C was considered strictly a UNIX systems language. The version of C used on UNIX systems is known as PCC (portable C compiler). It is only in recent years that C has come to be viewed as a more general-purpose programming language. Throughout most of its history, the only formal specification for the C language was a document written by Ritchie entitled ‘The C Reference Manual’. In 1977, Ritchie and Brian Kernigham expanded this document into a full-length book called ‘The C programming Language’ often referred to as the K & R standard. With the emergence of personal computers (PC) and the growing popularity of C, K & R and PCC standards were no longer satisfactory. At that time, there were many variants of C, each differing in little ways. Finally, the American National Standard Institute (ANSI) formed a committee to define an official version of the C language. In 1983, the committee met for the first time and they have been meeting four times a year since then. The final version of the C standard was satisfied as an ANSI standard in 1989. The ANSI standard for the C language is specified in a document entitled American National Standard for Information Systems – Programming Language C. The address to obtain copies of ANSI standard, is American National Standard Institute, 1430 Broadway, New, York, NY 10018. The C programming language has acquired the reputation for being a mysterious and messy language that promotes bad programming habits. Part of the problem is that C gives special meanings to many punctuation characters, such as asterisks, plus sign, braces, angle brackets etc. which can be intimidating to the beginners. The other, more serious, complaint concerns the relative dearth of rules i.e. C does not have very strict rules (as in PASCAL, FORTRAN etc) to protect programmers from making accidental blunders. Also, C programmers have tremendous liberty to write unusual code. In many instances, this freedom allows them to write useful programs that would be difficult to write in other languages. However, the freedom may be abused by inexperienced programmers who delight in writing 10 Programming in C needlessly tricky code. Thus we conclude that C is a powerful language but it requires self-restraint and discipline. Also it should be kept in mind that there is a huge difference between good programs and working programs. A good program not only works, but is easy to read and maintain. It is very possible to write good programs in C language.

No comments:

Post a Comment