The programming language C was developed in the early 1970s by Dennis Ritchie at Bell Laboratories to be used by the UNIX operating system.
Unit – I : Basics of C Programming
CHAPTER
2
: INTRODUCTION TO C
Takeaways
• Writing a C program.
• Keywords
• Variables and constants
• Operator precedence chart
• Compiling and executing C programs
• C Tokens
• Identifiers
• I/O statements
• Type conversion and typecasting
• Basic data types
• Operators
INTRODUCTION
The programming language C was developed in the early 1970s by Dennis Ritchie at Bell Laboratories to be used by the UNIX operating system. It was named 'C' because many of its features were derived from an earlier language called 'B'. Although C was designed for implementing system software, it was later on widely used for developing portable application software.
C is one of the most popular programming languages. It is being used on several different software platforms. In a nutshell, there are a few computer architectures for which a C compiler does not exist.
It is a good idea to learn C because few other programming languages such as C++ and Java are also based on C which means you will be able to learn them more easily in the future.
Like many other modern languages, C is derived from ALGOL (the first language to use a block structure). Although ALGOL was not accepted widely in the United States, it was widely used in Europe. ALGOL's introduction in the 1960s led the way for the development of structured programming concepts.
Before C, several other programming languages were developed. For example, in 1967 Martin Richards developed a language called BCPL (Basic Combined Programming Language). BCPL was basically a type-less (had no concept of data types) language which facilitated direct access of memory. This made it useful for system programmers. Then in 1970, Ken Thompson developed a language called B. B was used to develop the first version of UNIX. C was developed by Dennis Ritchie in 1972 that took concepts from ALGOL, BCPL, and B. In addition to the concepts of these languages, C also supports the concept of data types. Since UNIX operating system was also developed at Bell Laboratories along with C language, C and UNIX are strongly associated with each other.
For many years, C was mainly used in academic institutions, but with the release of different C compilers for commercial use and popularity of UNIX, C was widely accepted by computer professionals.
C (also known as Traditional C) was documented and popularized in the book The C Programming Language by Brian W. Kernighan and Dennis Ritchie in 1978. This book was so popular that the language came to be known as 'K & R C'. The tremendous growth of C language resulted in the development of different versions of the language that were similar but incompatible with each other. Therefore, in the year 1983, the American National Standards Institute (ANSI) started working on defining the standard for C. This standard was approved in December 1989 and came to be known as ANSI C. In 1990, the International Standards Organization (ISO) adopted the ANSI standard. This version of C came to be known as C89. In 1995, some minor changes were made to C89, the new modified version was known as C95. Figure 2.1 shows the taxonomy of C language. During 1990s C++ and Java programming languages became popular among the users so the Standardization Committee of C felt that a few features of C++/Java if added to C would enhance its usefulness. So, in 1999 when some significant changes were made to C95, the modified version came to be known as C99. Some of the changes made in the C99 version are as follows:
• Extension to the character types, so that they can support even non-English characters
• Boolean data type
• Extension to the integer data type
• Including type definitions in the for statement
• Inclusion of imaginary and complex types
• Addition of //, better known as C++ style line comment
C is a robust language whose rich set of built-in functions and operators can be used to write complex programs. The C compiler combines the features of assembly languages and high-level languages, which makes it best suited for writing system software as well as business packages. Some basic characteristics of C language that defines the language and have led to its popularity as a programming language are listed below. In this book we will learn all these aspects.
• C is a high-level programming language which enables the programmer to concentrate on the problem at hand and not worry about the machine code on which the program would be run.
• Small size-C has only 32 keywords. This makes it relatively easy to learn as compared to other languages.
• C makes extensive use of function calls.
• C is well suited for structured programming. In this programming approach, C enables the users to think of problem in terms of functions/modules where the collection of all the modules makes up a complete program. This feature facilitates easiness in program debugging, testing, and maintenance.
• Unlike PASCAL it supports loose typing (as a character can be treated as an integer and vice versa).
• Structured language as the code can be organized as a collection of one or more functions.
• Stable language. ANSI C was created in 1983 and since then it has not been revised.
• Quick language as a well written C program is likely to be as quick as or quicker than a program written in any other language. Since C programs make use of operators and data types, they are fast and efficient. For example, a program written to increment a value from 0-15000 using BASIC would take 50 seconds whereas a C program would do the same in just 1 second.
• Facilitates low level (bitwise) programming.
• Supports pointers to refer computer memory, array, structures, and functions.
• Core language. C is a core language as many other programming languages (like C++, Java, Perl, etc.) are based on C. If you know C, learning other computer languages becomes much easier.
• C is a portable language, i.e., a C program written for one computer can be run on another computer with little or no modification.
• C is an extensible language as it enables the user to add his own functions to the C library.
• C is often treated as the second best language for any given programming task. While the best language depends on the particular task to be performed, the second best language, on the other hand, will always be C.
C is a very simple language that is widely used by software professionals around the globe. The uses of C language can be summarized as follows:
• C language is primarily used for system programming. The portability, efficiency, the ability to access specific hardware addresses, and low runtime demand on system resources make it a good choice for implementing operating systems and embedded system applications.
• C has been so widely accepted by professionals that com- pilers, libraries, and interpreters of other programming languages are often implemented in C.
• For portability and convenience reasons, C is sometimes used as an intermediate language for implementations of other languages. Examples of compilers who use C this way are BitC, Gambit, the Glasgow Haskell Compiler, Squeak, and Vala.
Basically, C was designed as a programming language and was not meant to be used as a compiler target language. Therefore, although C can be used as an intermediate language it is not an ideal option. This led to the development of C-based intermediate languages such as C.
• C is widely used to implement end-user applications.
Programming in C: Unit I (b): Introduction to C : Tag: : - Introduction, Background, Characteristics, Uses of C Programming
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation